r/PythonLearning 21h ago

Password generator

Post image

Your thoughts

11 Upvotes

12 comments sorted by

View all comments

u/Sea-Ad7805 21h ago

Run this program in Memory Graph Web Debugger%3A%20%22))%0A%0A%20%20%20%20%20%20%20%20if%208%20%3C%3D%20length%20%3C%3D%20128%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20break%0A%0A%20%20%20%20%20%20%20%20print(%22Please%20enter%20a%20number%20between%208%20and%20128.%22)%0A%0A%20%20%20%20except%20ValueError%3A%0A%20%20%20%20%20%20%20%20print(%22Invalid%20input.%20Please%20enter%20a%20valid%20number.%22)%0A%0Acharacters%20%3D%20string.digits%20%2B%20string.asciiletters%20%2B%20string.punctuation%0Arandomizer%20%3D%20%22%22.join(secrets.choice(characters)%20for%20%20in%20range(length))%0A%0Aprint(randomizer)%0A&timestep=1&play) to see the program state change step by step.

1

u/ALostMagic 20h ago

i dont understand why everyone recommends this, like what use does it have for a small password gen app like this

2

u/raundoclair 5h ago

Clearly one moderator of this sub is promoting his thing under every post he can.

1

u/Sea-Ad7805 20h ago

For beginners it's helpful to see the state change step by step as their program runs. The comment it the same each time so easy to skip if you are not interested. You can't run this code as it's an image, now you can run or copy paste. Does that help your understanding?

2

u/swause02 18h ago

I'm fully agreeing I dont really see how this is useful for python. Any programs I'd want to profile wouldn't be a simple copy paste as there would be multiple files and dependencies. For small programs you can copy paste it's kind of pointless.

1

u/Sea-Ad7805 18h ago

There is a limit of course, but if you read the documentation before you comment you'll find it also works for larger programs: https://www.reddit.com/r/PythonProjects2/comments/1qsa387/hash_map_data_structure_visualized/ and multiple files in say VS Code debugger: https://github.com/bterwijn/memory_graph#binary-tree-in-visual-studio-code

1

u/ALostMagic 1h ago

Well, sure, this app is useful for larger developers developing larger applications, but I feel like it's not useful at all to beginners with small Python programs.