Create a list of outputs of a while(Python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Create a list of outputs of a while(Python)

I want to create a list made of the outputs of a while process. Ex. i=3 while i>0: print(i) i-1 The list would be like [3,2,1]

18th Oct 2019, 5:40 AM
Guido Parlatore
Guido Parlatore - avatar
2 Answers
+ 3
list = [] i = 3 while i>0: list.append(i) i -= 1
18th Oct 2019, 5:52 AM
Trigger
Trigger - avatar
+ 2
Guido Parlatore First try to do by yourself if you want to learn coding because no-one can available every time to do your work.
18th Oct 2019, 7:33 AM
A͢J
A͢J - avatar