Mega Code Archive

 
Categories / Python / Tuple
 

Display one item through an index

inventory = ("a",              "b",              "c",              "d") index = int(raw_input("\nEnter the index number for an item in inventory: ")) print "At index", index, "is", inventory[index]