Question
Python: Exercise # 1. Create a dictionary called users, that includes the user name as the key and password as the value. # Both the
Python: Exercise
# 1. Create a dictionary called users, that includes the user name as the key and password as the value.
# Both the user name and password should be strings.
# The dictionary should contain: tatkinson - !2054570Athu, jcarter - 2#064636Cjas, hcheloa - 66$90154Chan, # kmcphee - 206@2113Mkar, npeterson - 2052&833Pnic
# 2. Print the dictionary.
# 3. Write a for in loop that prints the keys in the dictionary.
# 4. Write a for in loop that prints the values in the dictionary.
# 5. Write a for in loop that assigns the keys and values to seperate variables and prints the following
# line for each user in the dictionary: "User user name has a password of password."
# eg. User tatkinson has a password of !2054570Athu.
# 6. Write an if statement using the keywords not in to determine if user name pwheeler is in the dictionary. If pwheeler is not in the dictionary,
# print out "User pwheeler is not in the dictionary.", else print out "User pwheeler is in the dictionary.".
# 7. User kmcphee has updated their password to 2100606^Wpat. Update kmchphee's entry in the dictionary to reflect the password change.
# 8. Add User asaris with a password of 20178*07Saly to the dictionary and add mkholay with a password of 204736?5Kmal to the dictionary.
# 9. User tatkinson has retired, remove their entry from the dictionary. Print the dictionary.
# 10. Write code to create a set named set_a with the following floats: 1.50, 36.32, 60.00, 72.68, 84.79.
# 11. Write code to create a set named set_b with the following floats: 12.50, 24.75, 36.32, 48.84, 60.00.
# 12. Write code that creates another set containing only the elements that are found in both set_A and set_b,
# and assigns the resulting set to the variable set_c. Print set_c.
# 13. Write code that creates another set containing all the elements of set_a and set_b, and assigns the
# resulting set to the variable set_d. Print set_d.
# 14. Write code that creates another set containing the elements that appear in set_a but not in set_b,
# and assigns the resulting set to the variable set_e. Print set_e.
# 14. Write code that creates another set containing the elements that are not shared by set_a and set_b,
# and assigns the resulting set to the variable set_f. Print set_f.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started