""" one website has the following password requirements 1. length at least 8 chars but not longer than 15 2. has at least one letter 3. has at least one digit write a function valid_password(str) that takes one string parameter returns True if its a valid password, and False otherwise write a function random_str(size,min, max) that randomly generates a string of size characters, with ASCII values between min and max inclusive write main to test function valid_password and random_str """ import random def random_str(size,min, max): new_str="" for i in range(size): num=random.randint(min,max) #new_str+=(chr)(random.randint(min,max)) char=(chr)(num) new_str=new_str+char return new_str def valid_password(str): size=len(str) rule1=(size>=8 and size<=15) count_letter=0 count_digit=0 if(rule1==True): for item in str: if(item.isalpha()): count_letter+=1 elif(item.isdigit()): count_digit+=1 if(count_letter>0 and count_digit>0): return True else: return False else: return False def main(): """ str=random_str(10,32,126) print(str) low_letters=random_str(10,97,122) upper_letters=random_str(10,65,90) print(low_letters, upper_letters) """ """ if(valid_password(str)): print(str,"is valid password") else: print(str,"is not valid") if(valid_password(low_letters)): print(low_letters,"is valid password") else: print(low_letters,"is not valid") """ """ str1=random_str(10,32,126) print(str1) if(valid_password(str1)): print(str1,"is valid password") else: print(str1,"is not valid") """ str=input("enter string ") if(valid_password(str)): print(str,"is valid password") else: print(str,"is not valid") main()