Related questions
# 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.")
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 7 images
- C#(Sharp): I made my code and design below. Anybody can help me some correction and add some design button and code. "Need to make C# step by step design and code "Calculator where make a calculator program that can do add, subtract, multiply, divide and square root. It should have a memory save/restore function for one number. There should be a way to set the number of fraction digits displayed". Code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace AktCalc { public partial class Form1 : Form { string last = ""; bool minus = false; bool plus = false; bool divide = false; bool multiply = false; string memory = ""; public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { if (textBox1.Text.Contains(",")) { return; } else { textBox1.Text += ","; } } private void...arrow_forwardcan somone help me with this in c languagearrow_forwardC# languagearrow_forward
- Python 3 NO IMPORT PICKLE Please check the picture and add one more function(def) to display menu and fix the error in the code. Write a program that keeps names and email addresses in a dictionary as key-value pairs. You Must create and use at least 5 meaningful functions. A function to display a menu A function to look up a person’s email address A function to add a new name and email address A function to change an email address A function to delete a name and email address. This is the Required Output example: Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and email address 5. Quit the program Enter your choice: 2 Enter name: John Enter email address: John@yahoo.com That name already exists Menu ---------------------------------------- 1. Look up an email address 2. Add a new name and email address 3. Change an existing email address 4. Delete a name and...arrow_forwardOverview: Create a coin flip game that allows the user to guess whether the coin will be heads or tails. Save the data associated with the flip. Repeat for a total of 10 guesses/flips. Display result summary and details at end. Technical Requirements: Participant will guess whether a coin flip will result in Heads or Tails Computer will "flip" a coin to determine the side it lands using random generator import random at top of program result = random.randint(x,x) The program will display the results: Guess, Flip, Outcome (Match or No Match) The program will track the results and, when the game is over, display: Summary Detailed result of each turn Use parallel arrays to collect details from each turn that can be displayed as a table when the game is over Use running totals of each result detail to display at endarrow_forwardLAB RESTRICTIONS, PLEASE READ:- Do not add any imports, the ones that you need will be given to you.- Do not use recursion.- Do not use try-except statements, you should be able to anticipateor prevent any errors from happening at all! - Code in python - Should work for given doctest def longest_unique_substring(s: str) -> str:"""Given a string <s>, return the longest unique substring that occurs within<s>.A unique substring is a substring within <s> which DOES NOT have anyrepeating characters. As an example, "xd" is unique but "xxd" is not.If there are two equal length unique substrings within <s>, return the onethat starts first (i.e., begins at a smaller index). >>> longest_unique_substring('aab')'ab' """arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education