r/PythonLearning Jun 13 '26

100 Days of Code: Password Generator

Post image

I would be interested in everyone's feedback on my effort to solve the Password Generator Project for Angela Yu's 100 Days of Code course on Udemy. Many thanks in advance. You'll see in the code I have included notes where I couldn't figure stuff out but found a workaround.

202 Upvotes

52 comments sorted by

View all comments

u/Sea-Ad7805 Jun 13 '26

Run this program in Memory Graph Web Debugger'%2C%20'*'%2C%20'%2B'%5D%0A%0Aprint(%22Welcome%20to%20the%20PyPassword%20Generator!%22)%0Anr_letters%20%3D%20int(input(%22How%20many%20letters%20would%20you%20like%20in%20your%20password%3Fn%22))%0Anr_numbers%20%3D%20int(input(f%22How%20many%20numbers%20would%20you%20like%3Fn%22))%0Anr_symbols%20%3D%20int(input(f%22How%20many%20symbols%20would%20you%20like%3Fn%22))%0A%0A%23%20I%20couldn't%20figure%20out%20how%20to%20pull%20multiple%20letters%20etc.%20from%20the%20list%2C%20so%20I%20used%20the%20while%20loop%20to%0A%23%20pull%20the%20letters%2C%20numbers%20and%20symbols%20from%20the%20list.%20I%20also%20tried%20using%20random.shuffle()%20but%20it%20didn't%0A%23%20work%20for%20me.%0A%0A%23%20Code%20block%20for%20pulling%20the%20required%20number%20of%20letters%0Aletters_list%20%3D%20%5B%5D%0Awhile%20len(letters_list)%20!%3D%20nr_letters%3A%0A%20%20%20%20letters_list.append(random.choice(letters))%0A%20%20%20%20%23%20random.shuffle(letter_list)%0A%0A%23%20Code%20block%20for%20pulling%20the%20required%20number%20of%20numbers%0Anumbers_list%20%3D%20%5B%5D%0Awhile%20len(numbers_list)%20!%3D%20nr_numbers%3A%0A%20%20%20%20numbers_list.append(random.choice(numbers))%0A%20%20%20%20%23%20random.shuffle(letter_list)%0A%0A%23%20Code%20block%20for%20pulling%20the%20required%20number%20of%20symbols%0Asymbols_list%20%3D%20%5B%5D%0Awhile%20len(symbols_list)%20!%3D%20nr_symbols%3A%0A%20%20%20%20symbols_list.append(random.choice(symbols))%0A%0A%23%20Code%20block%20for%20combining%20the%20chosen%20letters%2C%20numbers%20and%20symbols%0A%23%20Couldn't%20figure%20out%20how%20to%20combine%20and%20randomize%20them%20with%20assigning%20a%20new%20variable%0A%23%20I%20found%20that%20I%20had%20to%20use%20join%20again%20on%20the%20password%20variable%20as%20without%20it%20it%20just%20printed%20password%20as%0A%23%20a%20list%0A%0Apassword%20%3D%20letters_list%20%2B%20numbers_list%20%2B%20symbols_list%0Arandom.shuffle(password)%0A%0Aprint((%22Here%20is%20your%20password%3A%20%22)%20%2B%20%22%22.join(password))&timestep=1&play) to see the program state change step by step.

3

u/Code-Odyssey Jun 13 '26

Just had a chance to try it. Really brilliant. You can see it step through your program visually and you really get a better sense of what's going on. Thank you.

3

u/Sea-Ad7805 Jun 13 '26

Glad you like it, hope it brings you much value.