Conversion of the outputs of a for loop into an array

Published: 12/06/2019
Conversion of the outputs of a for loop into an array
Source: STACKOVERFLOW.COM

I am learning Python and coding in general and here's something I stumbled upon: n=int(input()) for i in range(1,n+1): print(i) Now, I want the output in the form of an array. So if n=4 , I want the output to look like my_array = [1,2,3,4] . How can I do that?

Read more
Related news
Comment
FACEBOOK