Question
Please solve the python question. A problem you are trying to solve has one data structure named dict1 in the starter code below. You have
Please solve the python question. A problem you are trying to solve has one data structure named dict1 in the starter code below. You have been asked to do the following:
Use a for loop statement to go through the keys in descending order in your dict1 dictionary. For each iteration in your loop statement, print the key-value pairs in your dict1 dictionary. Hint: consider using statements reversed(), sorted() and dict1.keys() in your solution.
Your script should provide console output as indicated in the sample output below.
Starter code
dict1 = {'e': 2, 'j': 4, 'a': 3, 't': 6, 'q': 1}
Expected output:
key: t ; value: 6
key: q ;value: 1
key: j ; value: 4
key: e ; value: 2
key: a; value: 3
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