Mar-27-2017, 09:46 PM
Hey Guys,
I'm new to Python programming and am having trouble finding some information on some coding I am trying to write for fun. I have some experience with c++ programming so i understand some of the basic structure of coding, however i can't find a way to get the program I am working on to do what i need it to.
Basically i am trying to take user input and store it to a variable and store that variable to a list defined by another variable then be able to retrieve that user input by having the user enter a number so...
user inputs item_number as 75 lets say 75 is for this purpose a serial number
user inputs item_name as hat
user inputs item_price as 10.25
this would be the information for item1
so item1 = [item_number, item_name, item_price]??
then if the user chooses to list all items stored i would print item1
where the items and there info would be listed
1: s/n 75
hat
10.25
formatting aside at this time I want the user to be able to reference the s/n but not actually have to enter the s/n to select the number
firstly can a variable that is defined with user input from an if statement be stored in a list as i have it here above
and if it can then is it as simple as assigning that "item1" to be printed if the user inputs say the number 1??
I'm new to Python programming and am having trouble finding some information on some coding I am trying to write for fun. I have some experience with c++ programming so i understand some of the basic structure of coding, however i can't find a way to get the program I am working on to do what i need it to.
Basically i am trying to take user input and store it to a variable and store that variable to a list defined by another variable then be able to retrieve that user input by having the user enter a number so...
user inputs item_number as 75 lets say 75 is for this purpose a serial number
user inputs item_name as hat
user inputs item_price as 10.25
this would be the information for item1
so item1 = [item_number, item_name, item_price]??
then if the user chooses to list all items stored i would print item1
where the items and there info would be listed
1: s/n 75
hat
10.25
formatting aside at this time I want the user to be able to reference the s/n but not actually have to enter the s/n to select the number
firstly can a variable that is defined with user input from an if statement be stored in a list as i have it here above
and if it can then is it as simple as assigning that "item1" to be printed if the user inputs say the number 1??