As part of our exam preparation, we were tasked with making a simple password generator. This was to help in applying what was learned throughout the year, as well as practice for the performance task.

The program takes two inputs from the user, following a brief algorithm to introduce variations in possible outputs. It requests for their name and favorite number.

From there, the program sets two variables as the basis for the password, in which the capitalized “name” input and the reversed integers exist. Along with the reversed integers, a random special character from a previously initialized list is selected. A coin flip decides whether the name or the number is first in the password string, providing some unpredictability without being impossible to remember. Because the user inputs might be predictable, modifying them slightly has the chance to make them more secure without compromising usability; the user still needs to remember the string.

I am happy with how this project turned out at the time, as it was the first major coding assignment in this class. If I was to redo this, it would need to include more complexity and better prompt capability for variety.

Sample Output

Enter your first name: john
Enter your favorite number (integer): 67
John76*

Program Code

# Simple Password Generator
'''
Objective: You will create a simple program that generates a unique password based on user input. This task 
introduces string manipulation, variables, randomness, and procedural abstraction, aligning with 
the CSP AP Create Performance Task (CPT). 
 
Instructions: 
1. User Input: 
     o Ask the user for their first name and favorite number. 
2. Processing & Transformation: 
    o Convert the first letter of their name to uppercase. 
    o Append a random special character (! @ # $ % ^ & *) to the password. 
    o Reverse the order of characters in the favorite number. 
3. Password Generation: 
   o Combine the transformed inputs into a secure password. 
4. Output: 
   o Display the generated password to the user. 
'''
import random
 
schars = ["!","@","#","$","%","^","&","*"]
fname, fnum = input("Enter your first name:").capitalize(), (input("Enter your favorite number (integer):")[::-1]) + random.choice(schars)
if random.choice((1,2)) > 1:
    passw = fname + fnum
else:
    passw = fnum + fname
print(passw)