Usernames An online company needs your help to implement a program that verifies the username chosen by a new user. Their rules is described below: Username MUST contain at least 6 characters; Username cannot start with a number; Username can only contain letters or numbers. If valid, the username may be resgistered if it doesn't already exist in the system. You should not use built-in functions to determine the character type such as isnumeric() or islower(). Use the strings given alphabet and numeric to determine if each character is valid. Use the list registered to help you determine if the username is already registered. Don't forget to execute the cell below to use these strings # run this cell to create these variables alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' numeric = "0123456789" registered = ["john87", "topmage", "light4ever", "username2"] Write a function nameValidation which receives a String argument name. This function: has name String argument: the name for the tag return True if the name is valid, or False otherwise Other notes: This function is not case sensititve. This means either lowercase or uppercase characters are valid; you should not use a String built-in function to help you with this. You should use the "flag technique" to implement this function. Document your code using comments. Write at least 3 test cases to demonstrate your function's expected behaviour. [ ]: # Your solutiondef nameValidation [ ]: # Test cases print(nameValidation("ARYA STARK")) # expected output False print(nameValidation("JIMSMITH")) # expected output True print(nameValidation("k8")) # expected output False print(nameValidation("Leah1")) # expected output False print(nameValidation("1friend")) # expected output False print(nameValidation("Galadr1EL")) # expected output True # Your test cases
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Usernames
An online company needs your help to implement a program that verifies the username chosen by a new user. Their rules is described below:
- Username MUST contain at least 6 characters;
- Username cannot start with a number;
- Username can only contain letters or numbers.
If valid, the username may be resgistered if it doesn't already exist in the system.
- You should not use built-in functions to determine the character type such as isnumeric() or islower().
- Use the strings given alphabet and numeric to determine if each character is valid.
- Use the list registered to help you determine if the username is already registered.
Don't forget to execute the cell below to use these strings
# run this cell to create these variables
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
numeric = "0123456789"
registered = ["john87", "topmage", "light4ever", "username2"]
Write a function nameValidation which receives a String argument name. This function:
- has name String argument: the name for the tag
- return True if the name is valid, or False otherwise
Other notes:
- This function is not case sensititve. This means either lowercase or uppercase characters are valid; you should not use a String built-in function to help you with this.
- You should use the "flag technique" to implement this function.
- Document your code using comments.
- Write at least 3 test cases to demonstrate your function's expected behaviour.
Step by step
Solved in 2 steps with 1 images