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))
Submitting answers is currently unavailable.
Write a program that receives the user's name from the input and prints the following welcome message what is your name: amirhossein welcome amirhossein
Write a program that gets the user's age from the input and calculates and prints the user's birthday
Write a program that translates the following words from Farsi to English and vice versa. The program must be implemented infinitely and it is possible to add new words easily words: Hello = hello goodbye = bye Kata ...
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 ...
Write a code that uploads a video with an address (test) on the page. There are video control buttons too
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.