Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise part04-13_add_items_to_list: mistake in sample output #93

Open
Oula123 opened this issue Nov 2, 2022 · 0 comments
Open

Exercise part04-13_add_items_to_list: mistake in sample output #93

Oula123 opened this issue Nov 2, 2022 · 0 comments

Comments

@Oula123
Copy link

Oula123 commented Nov 2, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant