MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/gzila7/python_3_in_one_pic/fthz169/?context=3
r/Python • u/TheInsaneApp • Jun 09 '20
167 comments sorted by
View all comments
613
How is this "Python 3 in One Pic"?
Let's forget about all the built-in modules.
Here are a bunch of features missing (not duplicating the other such complaint here on this page):
generators
list/dict/set comprehensions
f-strings
with statements
with
Function definitions
parameter passing (args, kwargs, etc)
args
kwargs
Whatever it's called when you pull lists apart: first, *rest = some_list
first, *rest = some_list
list slicing
I believe I could double the length of that list without much trouble.
0 u/anitapu Jun 09 '20 Can someone help me with Python? If I'm trying to print out something like the word oxygen 1,000 times what's the code to do that? 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')
0
Can someone help me with Python? If I'm trying to print out something like the word oxygen 1,000 times what's the code to do that?
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')
3
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')
613
u/[deleted] Jun 09 '20
How is this "Python 3 in One Pic"?
Let's forget about all the built-in modules.
Here are a bunch of features missing (not duplicating the other such complaint here on this page):
generators
list/dict/set comprehensions
f-strings
withstatementsFunction definitions
parameter passing (
args,kwargs, etc)Whatever it's called when you pull lists apart:
first, *rest = some_listlist slicing
I believe I could double the length of that list without much trouble.