Scientific Computing
Create a new python file called activity20.py
and save to your cs100/ch4
folder.
cents = { 'Nickel': 5, 'Dime': 10, 'Quarter': 25, 'Dollar': 100}
personnel = {'Joe': 2000, 'Ana': 2500, 'Bob': 1800, 'Chris': 2100, 'Diana': 1900}
Write Python code (no function need) to create a dictionary named userPasswords
which holds 5 pairs of userName: password
. Your program should allow for the user to input these pairs. Print the dictionary.
Add code that asks the user to input their username and then their password. Check if the passwords match.
Challenging: Create a new dictionary called protectedUserPasswords
which asks the user to type in 5 pairs of userName: password
. This time, store the password as encrypted text rather than plain text. Next, add code so that the user can input their username/password and check for a match. Hint: think about how to match a password to an encrypted password.
Submit your working activity20.py
to Moodle.