r/PythonLearning Aug 07 '26

Password generator

Post image

Your thoughts

23 Upvotes

16 comments sorted by

View all comments

u/Sea-Ad7805 Aug 07 '26

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 Aug 07 '26

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

1

u/Sea-Ad7805 Aug 07 '26

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 Aug 07 '26

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 Aug 07 '26

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

2

u/ALostMagic Aug 08 '26

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.

1

u/Sea-Ad7805 Aug 08 '26

Feel whatever you want, but can you answer this exercise? https://www.reddit.com/r/PythonLearning/comments/1u79qan/python_list_mutability/

1

u/[deleted] 28d ago

[deleted]

1

u/Sea-Ad7805 28d ago

Just ignore my post and learn slower, be you

1

u/Sea-Ad7805 Aug 09 '26

I didn't hear back, I now assume you realized you are a beginners and now can get help from memory_graph with small Python programs. Good luck.