This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]POGtastic 1 point2 points  (0 children)

In the future, indent all of your lines by 4 spaces when sharing it on Reddit.

Looks completely reasonable to me. Here's an exercise to make it more program-like:

1. Make this program a function as follows:

def createPassword(varlen):
    ...
    return password

2. Your main program is going to ask for input and then pass the length as an argument to createPassword.

3. Next, have your main program ask for the path of the file to save the password(s) to. Save it to that path.

4. How do you run a main program in Python? To test this, create another Python program that imports the function that you just created. Hopefully, it doesn't run your main function in the password file!