0

Can someone show me how to make a variable array in python, using a while loop thanks :)

Beginner

24th Jan 2020, 2:08 PM
Stephen Vonk
Stephen Vonk - avatar
7 Answers
24th Jan 2020, 3:31 PM
Sebastian Keßler
Sebastian Keßler - avatar
+ 2
bfo = ['brofarops', 'diversified'] bfo.append('services') print(bfo)
24th Jan 2020, 2:46 PM
BroFar
BroFar - avatar
0
What do you want to save in your array and why do you need a while loop for creating this array? You can of course add elements to an array using a while loop but there are so many scenarios to do that
24th Jan 2020, 2:31 PM
Jnn
Jnn - avatar
0
I need to save integers in the array and the while loop is just for a better understanding. Thanks
24th Jan 2020, 2:33 PM
Stephen Vonk
Stephen Vonk - avatar
0
Ah okay so to make it variable just set x = input()
24th Jan 2020, 2:44 PM
Stephen Vonk
Stephen Vonk - avatar
0
No its also variable if you say x=0 . With input() you can get user input. But if you want to get an int as input you have to cast the input to an int: x = int(input())
24th Jan 2020, 3:12 PM
Jnn
Jnn - avatar
0
I see thankyou!
24th Jan 2020, 3:14 PM
Stephen Vonk
Stephen Vonk - avatar