x = (int(input("How many items do you want in your list? ")))
for i in range(1, x + 1):
input("Enter string " + str(i) + ":")
Put 4 list numbers here
Enter string 1:Apple Enter string 2:Toy Enter string 3:Banana Enter string 4:Doll
Put it in
["Apple", "Toy", "Banana", "Doll"] I don't know how to express it. I tried everything I knew, but only the last result was printed. Help me! ㅜ<
python
After setting the list type variable for the item, You can take the input from the for statement and put it in the variable.
Please refer to the code.
x = (int(input("How many items do you want in your list? ")))
items = []
for i in range(1, x + 1):
items.append(input("Enter string " + str(i) + ":"))
print(items)
© 2024 OneMinuteCode. All rights reserved.