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 prints the figure below in the output *******************************
Write the absentee presentation program: The teacher enters the students' names in the classroom every day in a file with the name of that day in the name of that day and in the TXT format, the teacher can enter the date by entering the date ...
To DIV below what css slide to make the heart shape<div class="heart"></div>
Write a program that receives a number and from that number to 0 countdown is required between each number of 1 second pauses
Write a program that receives a solar date from the input (in the format of yyyy/mm/dd). Then convert the date to AD and print in the output
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.