Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
If I edit your code a bit then it can be done by using a list: https://code.sololearn.com/ca218a258a14 Here is an example using list comprehension: https://code.sololearn.com/c4a4A15a10A1
16th Apr 2021, 8:53 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
n=int(input()) l=[n*(2**(i-1)) for i in range(1,13)] print(l) #this is an old problem with the prize for the chess creator
16th Apr 2021, 9:08 AM
Shadoff
Shadoff - avatar
+ 1
you would need to create a list and append, or use list comprehension, or use list() with an iterable.
16th Apr 2021, 8:35 AM
Slick
Slick - avatar