This is my first post, I’m very new to coding and have been learning Python for a little over a month now. I learned about dictionaries today and before even finishing the syllabus segment, I had a fun challenge for myself: I had the idea to create and populate a dictionary by taking names and assigning a username and temporary password. My initial thought was an easy way to help onboard new hires to a company using its own internal software or something similar. Really it was just a proof of concept and a challenge for myself to see if I could do it.
I did not utilize list comprehension and I’m sure there are several ways to decrease the size of this chunky function, but it does at least work consistently (thankfully).
I was hoping for some feedback on two things specifically, though any feedback is appreciated.
-First, I was curious of ways to decrease its size and/or of things that could be written in a better way or were unnecessary.
-Second, pertaining specifically to the password list population loop: I have an initial while loop, but it seemed not to do the trick? Adding an if statement at the end pertaining to the same constraint I tried to enforce with the while loop made it work, but it doesn’t seem to work properly unless both constraints are present. I’m also curious as to why the if statement at the end needed to be ‘IF -list length- < 3’ to produce a list length of 4.
I’m sure I’ve probably been looking at it too long and have overthought it, which in addition to lack of experience made it how it is. This was written on portion 6 of 9 in the dictionaries segment of the python 3 course (just did portion 7 and realized dictionary comprehensions were a thing, oh well).
I’m still proud of myself for achieving my initial goal as a beginner, but again, any feedback would be greatly appreciated
(sorry this is so wordy!)
Here’s the code: