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 receives a number of input and from that number to zero countdown and prints in the output
Write a function that receives a string and checks all the letters. If all the letters of the string were small, otherwise False would return
Write a program that receives any professors including name, age and city from the entrance.
Write a program that gets the user's date of birth and determines how many years, months and a few days have passed since his birthday
Write a class called Vehicle that has Model and Color features and has a method called get_info that returns all its features as a strang then write a class called Car from Vehicle ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.