First, watch the demo video below. Your task is to code something like this, and use the code below to get started
You can edit the code below in repl.it. Alternatively, you can simply cut and paste the below into your own python file
#RUN THE PROGRAM and see what it does #this is not how validation for email works. It usually does NOT allow spaces #**************Task: The generated email should be in the following format: #the input MUST be lower case #the input must contain digits #If the input is: johnnysmith >> email should be: [email protected] #if the input is: marthajones >> email should be [email protected] """ A FEW IMPORTANT COMMANDS word.isalnum() #check if all char are alphanumeric word.isalpha() #check if all char in the string are alphabetic word.isdigit() #test if string contains digits word.istitle() #test if string contains title words word.isupper() #test if string contains upper case word.islower() #test if string contains lower case word.isspace() #test if string contains spaces word.endswith('d') #test if string endswith a d word.startswith('H') #test if string startswith H """ def hasSpace(username): #this is a little function that takes the paramater username return any(char.isspace() for char in username) #this returns TRUE if any character in username includes a space def main(): print("*************************** Create an e-mail address*********************") print("*************************** ********************** ") username=input("Please enter your desired username:" ) if username.islower() and hasSpace(username): #if the username is lowercase and IF the function hasNumbers returns True then....do the folllwing email=username+"@gmail.com" print("Your unique email address is now:", email) else: print("Your username needs to be lower case and have spaces...............") main()
A sample flow chart (design) for this particular challenge could look like:
Test No. | Description | Test Data(input) | Expected Outcome | Actual Outcome | Further Action? |
---|---|---|---|---|---|
1 | |||||
2 | |||||
3 | |||||
4 | |||||
5 |