Pseudo Design
Design an algorithm in pseudcode which performs the following tasks:
Asks the user to input a new username between 5 and 10 character in length
The main program of the algorithm calls a function called RangeCheck. This function accepts the username, lower limit and upper limit as parameters.
The RangeCheck function validates the username, which should be between 5 and 10 characters (inclusive),
The RangeCheck function returns either True or False depending on whether username is valid or not.
Finally, in the main program of the algorithm, “Username valid” or “Username invalid” is output depending on whether or not the username is valid.
So far I've got:
def validUsername(userName):
valid = True
if len(userName) > 10 or len(userName) < 5:
valid = False
return valid
uName = input("Please enter your username: ")
if not validUsername(uName):
print("This username is not valid")
def rangeCheck(integerVal, lowerLimit, upperLimit):
if integerVal < lowerLimit or integerVal > upperLimit:
return False
else:
return True
but not sure about the range check