Creating a list of inputted values


#1

Hi,

Looking for advice, as I’ve been all over looking for guidance.

I need my input list to repeat to capture 8 grocery items and prices. I was able to successfully write a progra to capture the name and price and print in the correct format but can’t figure out how to loop the inputs to allow other items.


#2

you need a dictionary:

d = {}

then add the item and price to the dictionary.

Given you want to do this 8 times, you might want to use a loop

you might also want to convert price to integer/float, do you really want it to be a string?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.