Create a dictionary to store days as key and number for each dayas follows. Write a Python
Fantastic news! We've Found the answer you've been seeking!
Question:
Create a dictionary to store days as key and number for each dayas follows. Write a Python script to sort this dictionary BY VALUEin ascending and descending orders. Print out the results asfollows,
Transcribed Image Text:
1. Create a dictionary to store days as key and number for each day as follows. Write a Python script to sort this dictionary BY VALUE in ascending and descending orders. Print out the results as follows, {"Tuesday": 2, 'Sunday': 7, 'Monday': 1, 'Thursday': 4, 'Friday': 5, 'Wednesday': 3, 'Saturday': 6} Output in ascending order: Monday => 1 Tuesday => 2 Wednesday => 3 Thursday => 4 Friday => 5 Saturday => 6 Sunday => 7 Output in descending order: Sunday => 7 Saturday => 6 Friday => 5 Thursday => 4 Wednesday => 3 Tuesday => 2 Monday => 1 1. Create a dictionary to store days as key and number for each day as follows. Write a Python script to sort this dictionary BY VALUE in ascending and descending orders. Print out the results as follows, {"Tuesday": 2, 'Sunday': 7, 'Monday': 1, 'Thursday': 4, 'Friday': 5, 'Wednesday': 3, 'Saturday': 6} Output in ascending order: Monday => 1 Tuesday => 2 Wednesday => 3 Thursday => 4 Friday => 5 Saturday => 6 Sunday => 7 Output in descending order: Sunday => 7 Saturday => 6 Friday => 5 Thursday => 4 Wednesday => 3 Tuesday => 2 Monday => 1
Expert Answer:
Answer rating: 100% (QA)
Python version 36 Python program to create a dictionary and then display the contents of the diction... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a shell script that produces a file of sequential numbers by reading the last number in the file, adding 1 to it, and then appending it to the file. Run one instance of the script in the...
-
For each product, display in ascending order, by product ID, the product ID and description, along with the customer ID and name for the customer who has bought the most of that product; also show...
-
Create new queries for Coast Jewelers a. Create and print a query for Coast Jewelers that lists the supplier name, contact name, and phone number of every supplier. Save the query as Supplier Query...
-
Are there accomplishments for which you individually receive credit which others helped you accomplish?
-
What is the potential danger of using a physical attribute, such as a retina scan or a fingerprint, to authenticate a user?
-
In seawater, a life preserver with a volume of 0.0400 m 3 will support a 75.0-kg person (average density 980 kg/m 3 ), with 20% of the persons volume above the water surface when the life preserver...
-
Separation of duties refers to separating all of these functions except which of the following? a. Authorizing transactions b. Keeping accounting records C. Hiring personnel d. Maintaining custody of...
-
General Corporation has found that 60% of its sales in any given month are credit sales, while the remainder are cash sales. Of the credit sales, the company has experienced the following collection...
-
Beginning inventory balances are as follows: Raw materials Work in process Finished goods on The following events took place during the year: Time left 0:26:16 Hide $15040 $73970 $47930 Purchases of...
-
Scientists have studied how snakes grip and climb ropes. In one study, they found that an important characteristic of a rope is its "compliance"--that is, how easily the rope, while under tension,...
-
4a) Rewrite the following messages using the "You attitude" approach. i) It is so frustrating to mark work which lacks effective spelling and good grammar. Lack of thorough citing and referencing is...
-
Performance Products Corporation makes two products, titanium Rims and Posts. Data regarding the two products follow: Direct Labor- Hours per unit Rims Posts 0.80 0.60 Annual Production 19,000 units...
-
How to Calculate Stock Return on Excel withthe adjusted closing price the data on the left is the risk-freerate obtained from French data library. Rate on the right is dataobtained from yahoo Need...
-
21. DOES THE U.S DOLLAR INDEX WEAKEN IF THE US GROWTH ACCELERATES ? 22. THE U.S DOLLAR INDEX WEAKEN IF THE INTEREST RATE DIFFERENTIALS NARROW BETWEEN THOSE NATIONS ?
-
F. What is the cash flow to stockholders for 2020? CF to stockholder div paid - net NEW equity raised CF to stockholder= G. What is the cash flow to creditors for 2020? CF to creditors div paid - net...
-
1. Define and explain the meaning of a predetermined manufacturing overhead rate that is applied in a job order costing system. ting 2. What are the advantages and disadvantages of using the cost of...
-
Consider the Proportional and Integral (PI) controller as shown in Figure 2. Vi(s) PI Controller Kp KI S W|N + 1 S Figure 2 1 Motor Vo(s) a. Determine the closed-loop transfer function of the system....
-
Activator rod AB exerts on crank BCD a force P directed along line AB. Knowing that P must have a 100-N component perpendicular to arm BC of the crank, determine (a) The magnitude of the force P, (b)...
-
What information is provided in the financing activities portion of the cash budget?
-
The Wine Depot is planning for the future and would like you to prepare a present value analysis. Using the file ch7-07, complete a present value analysis for the following situations save the file...
-
What are the key accounting topics addressed in this text that relate to your learning Excel?
-
Owing to a small federal grant from the Department of Housing and Urban Development (HUD) to the Town of Stillman, Nadine Gordimer, CPA has performed grant audits for the town in each of the past...
-
A public accounting firm has been engaged to perform the audit of a local, federally funded Housing Allowance Program. The objective of the program is to increase the housing standards of Agana...
-
The City of Central Falls has engaged Robert Cohen, CPA to audit the June 30, 1999 financial statements of the City's Water Department under the GAO's Government Auditing Standards. Cohen's report...
Study smarter with the SolutionInn App