# Dr. V # Nov 6 # A program to create a simple interactive database import random records = [["Ben","Austin",2016,"blue"],["Rachel","Bickauskas",2016,"orange"],["Nick","Crawford",2016,"yellow"],["Craig","Davis",2014,"scarlet"],["Pat","Doherty",2015,"brown"],["Zach","Felix",2014,"green"],["Adam","Gosier",2015,"purple"],["Kevin","Hu",2015,"orange"],["James","Kleatsch",2016,"peach"],["Colin","Krafft",2013,"pink"],["Patrick","Lawlor",2015,"mauve"],["Andrew","Nolan",2016,"black"],["Abby","Ross",2015,"red"],["Tom","Rummel",2015,"blue"],["Chris","Shannon",2016,"burgandy"],["Luke","Steelman",2015,"violet"],["Paige","Studlack",2013,"green"],["Lauren","Ward",2016,"black"],["Brandon","Wilkinson",2014,"red"]] for j in range(0,len(records)): favnum = random.randint(1,100) records[j].append(favnum) def menuoptions(): print "Please select from among the following options." print "\n1) Print all the records." print "2) Add a new record to the list." print "3) Delete a record." print "4) Search for a specific record." print "5) Modify a particular record." print "6) Quit." choice = input("Choose an option: ") while choice < 1 or choice > 6: choice = input("Just enter a number from 1 to 6: ") return choice def printrows(records): pass # this is for HW def deleterec(records): # you figure out this part return records # more function definitions here def specrec(records): name = raw_input("What name would you like to see? ") print "\nHere are the records matching this name." for j in range(0,len(records)): if records[j][0] == name: print records[j][0], records[j][1], "class", records[j][2], "color", records[j][3], "fav num", records[j][4] option = 1 while option != 6: option = menuoptions() if option == 1: printrows(records) elif option == 2: pass # call appropriate function here elif option == 3: records = deleterec(records) elif option == 4: specrec(records)