Level 2: Beginner
import random as rd
import string as st
print('Welcome to the password generator !')
x1=int(input('Input the length of the pwd(minimum 6'))
x=input('Include upper case letters (yes/no)')
y=input('Include numbers (yes/no)')
z=input('Include special characters(yes/no)')
match(x,y,z):
case('yes','yes','yes'):
character=st.ascii_letters+st.digits+st.punctuation+st.ascii_uppercase
pwd=''.join(rd.choice(character) for i in range(x1) )
print(pwd)
case('no','yes','yes'):
character=st.ascii_lowercase+st.digits+st.punctuation
case('yes','no','yes'):
character = st.ascii_letters + st.ascii_uppercase + st.punctuation
pwd = ''.join(rd.choice(character) for i in range(x1))
case('yes','yes','no'):
character = st.ascii_letters + st.ascii_uppercase + st.digits
case('no','no','yes'):
character = st.ascii_lowercase + st.punctuation
case ('yes', 'no', 'no'):
character = st.ascii_uppercase + st.ascii_letters
import random as rd
import string as st
print('Welcome to the password generator !')
x1=int(input('Input the length of the pwd(minimum 6'))
x=input('Include upper case letters (yes/no)')
y=input('Include numbers (yes/no)')
z=input('Include special characters(yes/no)')
match(x,y,z):
case('yes','yes','yes'):
character=st.ascii_letters+st.digits+st.punctuation+st.ascii_uppercase
pwd=''.join(rd.choice(character) for i in range(x1) )
print(pwd)
case('no','yes','yes'):
character=st.ascii_lowercase+st.digits+st.punctuation
pwd=''.join(rd.choice(character) for i in range(x1) )
print(pwd)
case('yes','no','yes'):
character = st.ascii_letters + st.ascii_uppercase + st.punctuation
pwd = ''.join(rd.choice(character) for i in range(x1))
print(pwd)
case('yes','yes','no'):
character = st.ascii_letters + st.ascii_uppercase + st.digits
pwd = ''.join(rd.choice(character) for i in range(x1))
print(pwd)
case('no','no','yes'):
character = st.ascii_lowercase + st.punctuation
pwd = ''.join(rd.choice(character) for i in range(x1))
print(pwd)
case ('yes', 'no', 'no'):
character = st.ascii_uppercase + st.ascii_letters
pwd = ''.join(rd.choice(character) for i in range(x1))
print(pwd)