Last active
June 3, 2021 16:41
-
-
Save mertbozkir/149152cf38e597ae694d170677378096 to your computer and use it in GitHub Desktop.
Codeland Username Validation Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def CodelandUsernameValidation(strParam): | |
if (4<len(strParam)<25) or (strParam[0] != str) or strParam[-1] == "_": | |
return False | |
return True | |
# keep this function call here | |
print(CodelandUsernameValidation(input())) | |
""" | |
Have the function CodelandUsernameValidation(str) take the str parameter being passed and | |
determine if the string is a valid username according to the following rules: | |
1. The username is between 4 and 25 characters. | |
2. It must start with a letter. | |
3. It can only contain letters, numbers, and the underscore character. | |
4. It cannot end with an underscore character. | |
If the username is valid then your program should return the string true, otherwise return the string false. | |
Use the Parameter Testing feature in the box below to test your code with different arguments.""" | |
# Question Link # | |
# https://coderbyte.com/information/Codeland%20Username%20Validation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment