Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

# Debug the following program and submit the CORRECT version

####### Lists

names = [
"chris",
"dan",
"edgar",
"bonnie",
"al",
"fran"
]

usernames = [
"202999",
"100345",
"299999",
"309890",
"298765",
"345678"
]

passwords = [
"password",
"password123",
"abcdef",
"asdfjkl;",
"ilovemom",
"abc123"
]

menuChoice = 0 # user's menu choice

###### functions

def printList(list):
# print list
print
print(list)
print

def displayMenu():
# displays user-friendly, creative menu
print
print
print("******* MENU *******")
print("1. (D)isplay list 1 in original order")
print("2. D(I)splay list 2 in original order")
print("3. (F)ind an item in the list 1")
print("4. (L)ogin")
print("99. (E)xit")
print
print

def isFound(list, value):
# finds a value in list returns True if found, False otherwise
if (value in list):
return True
else:
return False

###### main program

while (menuChoice != "99"):
displayMenu()
menuChoice = input("Enter a menu choice: ")

# handling menu choices
if (menuChoice == "10" or menuChoice.upper().strip() == "D"):
printList(names)
elif (menuChoice == "20"):
printList(usernames)
elif (menuChoice == "30"):
value = input("Enter the value you are searching for: ")

if (isFound(names, "Cooper")):
print(str(value) + " was found")
else:
print(str(value) + " was not found")

elif (menuChoice == "40"):
userInputtedUsername = input("Enter username: ")
userInputtedPassword = input("Enter password: ")

if (isFound(usernames, userInputtedUsername)):
positionInList = usernames.index(userInputtedUsername)

if (userInputtedPassword == passwords[positionInList]):
print("The username does match the password!")
# do something here since the user logged in correctly
else:
print("Invalid Password")

else:
print("That username does not exist.")

elif (menuChoice == "99"):
print("Goodbye")
break
else:
print("You entered an invalid menu choice.")

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education