Replies: 1 comment
-
Hi, this forum is not here for homework help. It's only purpose is for helping students in this particular course. Sorry, I can't help with this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm very new to Python. Just started a college course on it in May 2023. Currently working on building and improving my first simple application as a Final Project for the class. It is a beginner project.
The main goal is to create a password generator that takes user input for how many passwords to generate and the length of the passwords. Then it will request input on whether the user wants to save the passwords to a file. There is a menu item ("list") that is supposed to list the saved passwords from the previously saved file, but the output shows nothing and loops back to the command input.
I would appreciate any feedback on what I'm doing wrong or can improve in the overall code.
I'm also very new to GitHub so forgive me but I'll post the code I have so far here:
import random, csv
#generates passwords with special requirements
def get_passwds(num, length):
#defines character set
lettrs = "qwertyuiopasdfghjklzxcvbnm"
numbrs = "0123456789"
spchar = "!@#$%&*"
uppr = lettrs.upper()
#combines character sets
pswdChars = lettrs + numbrs + spchar + uppr
pwds = []
for i in range(num):
pwd = "".join(random.sample(pswdChars, length))
return pwds
def save_pwds(pwds):
with open("pwds.txt", "a") as file:
#writer = csv.writer(file)
for pwd in pwds:
file.write("{pwd}\n")
#writer.writerow([pwd])
def list_pwds():
with open("pwds.txt") as file:
def menu():
print("What would you like to do?")
print("list - List saved passwords.")
print("new - Get new passwords.")
print("exit - Leave the program.")
print()
#Application for generating a list of strong passwords at a length the user chooses
def main():
print(f"\tBrickWall\nThe Password Generator")
print()
menu()
more = "y"
while True:
command = input("Command: ")
if command == "new":
print("Bye")
if name == "main":
main()
Beta Was this translation helpful? Give feedback.
All reactions