Question
Python... my professor put this code up on the board... this shit doesnt work... whats wrong with it? def main(): first=input(Enter fist name) last=input(Enter last
Python... my professor put this code up on the board... this shit doesnt work... whats wrong with it?
def main(): first=input("Enter fist name") last=input("Enter last name") idnum=input("Enter ID number")
print("Your login name is") print(get_login_name(first,last,idnum))
def get_login_name(first:str,last:str,idnum:str)->str: set1=first[0:3] set2=last[0:3] set3=idnum[-3:] login_name=set1+set2+set3 return login_name #get password password=input("Enter Password") while not valid_password(password): print("password not valid") password=input("Enter Password") print("valid password")
def valid_password(password:str): '''validate password fulfill criteria''' #set boolean to false correct_length=false has_upper=fasle has_lower=flase has_digit=flase
#test for length if len(password)==7: correct_length=true for ch in passowrd: if ch.isupper(): has_uppercase=true if ch.islower(): has_lowercose=true if ch.isdigit(): has_digit=true if correct_length and has_uppercase and has_lowercase and has_digit: is_valid=true else: is_valid=false return is_valid
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started