2. In-depth reflection – what did you learn
Through-out improving my prototype, I enjoyed spotting out weak areas and being able to learn from my mistakes. I feel much better with this new prototype, however, I can definitely incorporate more aspects into my final product. As I am getting closer and closer to my empathetic goal of spreading effective passwords to my peers and community in Hong Kong, I am recognizing how secure our world would be if we all had a password from my generator now. I actually feel like my passwords will make it tougher for hackers to do illegal activity, which makes me feel like I can make my final prototype amazing. Starting off I needed to define some issues currently in my code. Which are the mul_pi function returning a two digit number, disorganized code, random_caps only returning capital letters, and no option for the user if he types in an invalid phrase. (Also, my code could have many more features, a lot of which I implement in the final product). I needed to ideate some solutions addressing these issues in my previous prototype. I managed to brainstorm a way to fix the conFU function and allowed it to replace the location of letters and numbers instead of just letters previously. You could just add numbers to the keys of the dictionary, and letters as its values, but I wanted to find a smarter and faster way of doing it. Another improvement was organizing the code and editing variable names like new_sequence to make variables consistent and overall making the code easier to read. Then I also needed to fix my random_caps function, as it would only capitalize letters, and not lowercase them even if randint resulted with 0, or false. All I had to do was add a .lower() to the losing statement. Finally, I needed to edit my welcome prompts, to address if the user types in something extraneous. I created a while loop so that the user wouldn’t be kicked out unless he answers yes or no, while specifying that he has to in the case that he doesn’t. Also, I learned about a real unique function that I had never known about, the exit() function. Say if you had more blocks of code in front of your while loop, using break would lead the computer to the next lines out of the loop. But if you just want to exit without running those lines, you can use exit(), which will completely abrupt the program.
I got an error from trying to iterate over a dictionary and make changes to it at the same time, and it took me quite some time to find out about the .copy() function, which lets you iterate the copy, and add to the original function. This allowed me to add the opposite values of the letters to the keys and their values as letters, which is faster than listing it manually.
Also, unfortunately, I could not get the mul_pi function to return only one digit from 0-9, as I was still unsure, but am still brainstorming a way.
Testing: Working as intended as nothing too major was done, but I could still definitely add more features in my final product:
4. Other resources you came across in this learning process?
Thanks to my peers for the support and clarifying my questions.
This taught me how to use the .copy() function