+ 4
Creating a list
What is the python code to create a list using a for loop?
6 Answers
+ 11
Mawande Mbudane , please show us your attempt before we can help. Thanks!
+ 4
#suppose you want to create a list from 1 to 100
X = [i for i in range(1,101)]
+ 2
print(*[ i for i in range((int(input("min scale"))),(int(input("max scale")))+1)],sep=", ")
#or
print([ i for i in range((int(input("min scale"))),(int(input("max scale")))+1)])
+ 1
1 add string
2 separate by comma
3 Concatenate
4 add [ ] đ€
+ 1
Thank you so much for all your valued input. I needed to use a loop to add items in a list though the append() append function. I cracked the code and wrote a lottery game (check my codes). Thank you all đ
0
name=[2,5,6,7,8,9,1]
for i in name:
print(i)