Question: ( Dict ) Given a dictionary grade = { A : 8 , D : 3 , B : 1 5 , F : 2
DictGiven a dictionary
gradeA : D : B:F : C:
Write python statements to print items a to e Functions not required, use your own print
statement strings:
a All the keys
b All the values
c All the key and value pairs
d All the key and value pairs in key order
e The average value
Question : Tea Leaves Sales Report
Here is the sample of the text file datafile for the tea sales teatxt The tea.txt file is provided for
you on Canvas. Your program must read from this text file tea.txt that is provided.
Green Tea:::
Earl Grey:::
Ceylon:::
Jasmine:::
Mint Tea:::
The above data reads as follows teaname:storeSales:storeSales:storeSales
The sample test run output displayed as followsno commas required for the numbers in
this output
Test run
Ceylon
Earl Grey
Green Tea
Jasmine
Mint Tea
The last row is the store totals for all the kinds of tea leaves sold. The last column is the total sale
for each kind of tea leaves sales. Note that the tea names are sorted.
a Write a program to read in the data from tea.txt textfile and then print the sample test run as
shown above.
b You must use dictionary, if a dictionary is not used as zero score will be assigned for
this question. You can also use list, tuples, sets if necessary.
c Functions not required but better to use functions
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
