Write a program that requests a password after the author/program information is
ID: 3735694 • Letter: W
Question
Write a program that requests a password after the author/program information is displayed. Make the password "hello". The program should then ask the user for their name: if the name entered is the same as your name, the program should respond with "What a great name!"; if they enter "Madonna" or "Cher", the program should respond "May I have your autograph, please?". For any other input, the program should respond with "(input name), that’s a nice name".
SAMPLE OUTPUT (including author/program information)
Program author: Barney Rubble
ID#: 1234567
Program 3—LOOPS AND IF CONDITIONS
Password? unicorn
Password? opus
Password? hello
Welcome to the second half of the program!
What is your name? Barney
What a great name!
ALTERNATE OUTPUTS
What is your name? Cher
May I have your autograph, please?
What is your name? Bill
Bill, that’s a nice name.
i need it in PYTHON please.
Explanation / Answer
'''
The below line is just asking for the input for passweord
'''
password = input("Program author:Barney Rubble ID#;1234567 Program3-LOOPS AND IF CONDITIONS Password?")
while password != "hello": # comparing the entered password with "hello"
password = input("Password?")
name = input("What is your name?")
if name == "Barney":
print("What a great name!")
elif name == "Madona" or name == "Cher":
print("May I have your autograph,please?")
else:
print(name,",that's a nice name")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.