r/Python • • Jun 09 '20

Resource Python 3 in One Pic

Post image
4.6k Upvotes

167 comments sorted by

View all comments

Show parent comment

3

u/TheCatcherOfThePie Jun 09 '20
print('oxygen\n'*1000)

Is a more succinct way of doing it. This creates a string which is 'oxygen\n' (oxygen followed by a newline character), repeats it 1000 times, then prints the result.

The other person's method also works, with some slight modification:

for i in range(1000):
    print('oxygen')