Username review function
Write a function that receives a username and if it was a character except the lowercase English letters, FALSE and otherwise TRUE
Write a function that receives a username and if it was a character except the lowercase English letters, FALSE and otherwise TRUE
def check(): name=input('name user name : ') new_name=name.isalnum and name.lower() if new_name == name: print(True) else: print(False) check()
def is_valid_username(username): # Check each character in the username for char in username: # If the character is except the lower case of English if not ('a' <= char <= 'z'): return False return True # Use examples print(is_valid_username("validusername")) # Output: TRUE print(is_valid_username("InvalidUsername")) # Output: FALSE print(is_valid_username("user_name")) # Output: FALSE print(is_valid_username("username123")) # Output: FALSE
def validate_username(username): for char in username: if not char.islower(): return False return True name=input("name: ") print(validate_username(name))
class name: def __init__(self,name1): self.name1=name1 def __str__(self): for i in self.name1: if not i.isupper(): return ('true') else: return ('flase') x=str(input('please enter your name:')) ob=name(x) print(ob)
listt=[' ','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] username=input("enter username: ") def check_username(listt,username): listt_check=[] for i in username: if i in listt: listt_check.append("True") else: listt_check.append('false') if 'false' in listt_check: status='false' else: status="true" print(status) check_username(listt,username)
def Name_Karbari(n) :
H = "QWERTYUIOPLKJHGFDSAZXCVBNM"
for i in n :
if i in H :
return False
return True
def is_valid_username(username): # Checking whether all characters are in English lowercase username for char in username: if not ('a' <= char <= 'z'): return False return True # Example of how to use username_input = input("لطفاً نام کاربری را وارد کنید: ") if is_valid_username(username_input): print("نام کاربری معتبر است.") else: print("نام کاربری باید فقط شامل حروف کوچک انگلیسی باشد.")
def username(name): return True if name.islower() else False i=input("name:") print(username(i))
def check_name(user_name:str) -> str:
return user_name.isalpha() and user_name.islower()
name=check_name("mohammadmahdi23@")
print(name)
#>>>نتیجه:False
Submitting answers is currently unavailable.
Write a program that prints the figure below in the output *******************************
Things need: The system administrator should be able to log in after entering the Admin username and password 12345 and add a new employee and define the username and password for each employee. The program must be informed ...
Build a table with HTML to show the following information: Name, Score, Hassan Hassani 17.25 Afforded Mohammadi Mohammed Hassani 13 Accept Mohammad Rezaei 9 Receives 19 Mardi Milad Mohammadi 12 ...
Write a function that receives the user's postcode as a parameter and checks whether the postcode is correct? Must be 15 digits?
Write a function that receives infinite parameter and returns the average of numbers. If the parameter was non -extensive, it ignores it
Write a function that receives a word and changes each letter to its next letter in the alphabet. Then returned the result. Indeed: "A" turns into "B" "" B "becomes" C "" C "becomes" D "and ........
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.