Reference no: EM132265297
John is the lab administrator. How is a Python program with if-else structure created that performs the following tasks:
(1) Ask the user to enter a username.
(2) If the entered username is John, print Hello, administrator!; If the entered name is NOT John, print Hello, XXX! (XXX is the username entered by user, don't forget the '!' at the end of message).
(3) At the end of the program, print Session end, good bye XXX! (XXX is the name entered by user, don't forget the '!' at the end of message).
Hint:
Don't forget to indent the statements in the if block (In Canvas, "Tab" is not adding spaces for you, so you have to manually type the "space" key).
>>> a = input("Enter a user name: ")
Enter a user name: John
>>> print ("Hello, administrator!")
Hello, administrator!
>>> print ("Hello",a, "!")
Hello John !
>>> print ("Session end, good bye",a, "!")
Session end, good bye John !