Question: John is the lab administrator. Write a Python program with if-else structure that performs the following tasks: (1) Ask the user to enter a username.

John is the lab administrator. Write a Python program with if-else structure 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).

Note that: if-else structure must be used (only one keyword if can be used)

The screenshot below contains two test runs: John is entered in the 1st test run; Alice is entered in the 2nd test run.

John is the lab administrator. Write a Python program with if-else structure

RESTART: C:\Users\kimxy One Enter your name: John Hello, administrator ! Session end, good bye John ! RESTART: C:\Users\kimxy One Enter your name: Alice Hello, Alice ! Session end, good bye Alice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!