Python Forum
Taking user input and storing that to a variable then storing that variable to a list
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Taking user input and storing that to a variable then storing that variable to a list
#8
items = [()]

while(1):

#       item_number_1 = [iten_number, iten_name, iten_price]
       print "what would you like to do?"
       print "1: Add item"
       print "2: edit item"
       print "3: remove item"
       print "4: list current items"
       option = raw_input( "please select an option ")
       if (option=="1"):
               print "we will now enter the information for this item"
               item_number = raw_input("what is the item number ")
               item_name = raw_input("what is the name of this item? ")
               item_price = raw_input("how much does this item cost? ")
               print "your items number is "
               print item_number
               print "your items name is "
               print item_name
               print "your items price is "
               print item_price
               items.append[(item_number, item_name, item_price)]

       if option=="4":
               print items
disregard options 2 and 3 ill deal with those later  with the code you just provided ill have to go back and change things for sure

Moderator Larz60+: Please use code tags. see: https://python-forum.io/misc.php?action=help&hid=25 I added them for you this time
Reply


Messages In This Thread
RE: Taking user input and storing that to a variable then storing that variable to a list - by jowalk - Mar-27-2017, 11:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with writing monitored data to mysql upon change of one particular variable donottrackmymetadata 3 380 Apr-18-2024, 09:55 PM
Last Post: deanhystad
  Commas issue in variable ddahlman 6 547 Apr-05-2024, 03:45 PM
Last Post: deanhystad
  Variable Explorer in spyder driesdep 1 301 Apr-02-2024, 06:50 AM
Last Post: paul18fr
  Mediapipe. Not picking up second variable stevolution2024 1 261 Mar-31-2024, 05:56 PM
Last Post: stevolution2024
Question Variable not defined even though it is CoderMerv 3 391 Mar-28-2024, 02:13 PM
Last Post: Larz60+
  optimum chess endgame with D=3 pieces doesn't give an exact moves_to_mate variable max22 1 316 Mar-21-2024, 09:31 PM
Last Post: max22
  difference between forms of input a list to function akbarza 6 1,156 Feb-21-2024, 08:02 PM
Last Post: bterwijn
  Reading and storing a line of output from pexpect child eagerissac 1 4,348 Feb-20-2024, 05:51 AM
Last Post: ayoshittu
  unbounded variable akbarza 3 564 Feb-07-2024, 03:51 PM
Last Post: deanhystad
  Variable for the value element in the index function?? Learner1 8 740 Jan-20-2024, 09:20 PM
Last Post: Learner1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020