Project - Password Generator
Project - Password Generator
SEE -2024-25
Computer Science(083)
Practical Exam
Student Information
Name:
Class: 11 A
Roll No:
Admission No:
Topic:
1
CERTIFICATE
____________________
Signature of Internal
Examiner
____________________
Principal’s Signature
2
INTRODUCTION
3
PYTHON CODE
import random
# Defining character sets manually
digits = "0123456789"
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_chars = "!@#$%^&*()_+-=[]{}|;:’,.<>?/"
# Getting password length
lent= int(input("Enter password length: "))
print("""Choose character set for password from these:
1. Digits
2. Letters
3. Special characters
4. Exit""")
charList = ""
# Getting character set for password
while True:
cho = int(input("Pick a number: "))
if cho == 1:
# Adding digits to possible characters
charList += letters
elif cho == 2:
# Adding letters to possible characters
charList += digits
elif cho == 3:
# Adding special characters to possible characters
charList += special_chars
elif cho == 4:
break
else:
print("Please pick a valid option!")
if not charList:
print("No character set selected. Exiting...")
else:
pwd = ""
for i in range(lent):
# Picking a random character from our character list
randomchar = charList[random.randint(0, len(charList) - 1)]
# Appending a random character to password
pwd += randomchar
4
Input Screens And Output Screens :-
5
6