Username Check
Write a program that checks the username of a user and welcomes them when the username is valid. It should first get a username from the user. The program will then check against three possible usernames and welcome each one accordingly.
Enter your username: CoolGuy Welcome back John
Enter your username: Amber51 Welcome back Jane
Enter your username: MountainClimber Welcome back Jamie
DECLARE username AS STRING
OUTPUT "Enter your username: "
INPUT username
IF username = "CoolGuy" THEN
OUTPUT "Welcome back John"
END IF
IF username = "Amber51" THEN
OUTPUT "Welcome back Jane"
END IF
IF username = "MountainClimber" THEN
OUTPUT "Welcome back Jamie"
END IF
username = str(input("Enter your username: "))
if username == "CoolGuy":
print("Welcome back John")
if username == "Amber51":
print("Welcome back Jane")
if username == "MountainClimber":
print("Welcome back Jamie")
# Get the username from the user.
username = str(input("Enter your username: "))
# Check if the username is 'CoolGuy'
if username == "CoolGuy":
# If the username is 'CoolGuy' then welcome John
print("Welcome back John")
if username == "Amber51":
print("Welcome back Jane")
if username == "MountainClimber":
print("Welcome back Jamie")
Extension
Extend the program to use else and elif. If no valid username is entered into the program, the program should display ‘No Valid User’.
Enter your username: Gamer123 No user with the username Gamer123.