You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the expected behaviour of the program the user is asked the following:
How many items: 3
Item 1: 10
Item 2: 250
Item 3: 34
[10, 250, 34]
So I created a code (which passed the test), but leads to the following output:
How many items: 4
Item: 1
Item: 2
Item: 3
Item: 4
[1, 2, 3, 4]
As you can see, the user is asked several times for "Item: " and not for "Item 1: ", "Item 2: ", etc.
This is my code:
list = []
number = int(input("How many items: "))
while number > 0:
item = int(input("Item: "))
list.append(item)
number -= 1
print(list)
The text was updated successfully, but these errors were encountered:
According to the expected behaviour of the program the user is asked the following:
How many items: 3
Item 1: 10
Item 2: 250
Item 3: 34
[10, 250, 34]
So I created a code (which passed the test), but leads to the following output:
How many items: 4
Item: 1
Item: 2
Item: 3
Item: 4
[1, 2, 3, 4]
As you can see, the user is asked several times for "Item: " and not for "Item 1: ", "Item 2: ", etc.
This is my code:
list = []
number = int(input("How many items: "))
while number > 0:
item = int(input("Item: "))
list.append(item)
number -= 1
print(list)
The text was updated successfully, but these errors were encountered: