I'm currently learning Python, and at the moment I'm writing a simple grocery list program.
At one point in the program, the user is asked how many items are on their shopping list. What I want to do is take the number that the user inputs (lets say it's 5), and the program then requests input from the user for 5 different grocery items (item name and cost). For the time being I've just added a bunch of code to accept values for 1 - 10 items, but I'd like to have a small chunk of code that can accept any value and request the appropriate amount of data. I'm terrible at explaining this, but basically if the user inputs 5 for their number of items, they're required to input information for 5 items. If they put 30 for their number of items, they're required to input information for 30 items. So when printed on their screen it would look something like:
How many items on your list? 5
Item 1 Name: Bananas
Item 1 Cost: $1.25
Item 2 Name: Pasta
Item 2 Cost: $ ..
All the way through Item 5 (or whatever number they gave the program).
I would appreciate any help, and sorry if my explanation was redundant / confusing.