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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!