Question: python basic please!! Lab 2A - Dictionaries 50 pts Directions: You will be given a file called FruitDat.txt. The format of the file will be

python basic please!!
python basic please!! Lab 2A - Dictionaries 50 pts Directions: You will
be given a file called FruitDat.txt. The format of the file will
be as follows integer key, val key, val key, val The first

Lab 2A - Dictionaries 50 pts Directions: You will be given a file called FruitDat.txt. The format of the file will be as follows integer key, val key, val key, val The first line of the file contains an integer that represents how many lines of data exist in the file. The remaining lines contain a string and a float separated by a comma. The string is intended to be the key for the dictionary (in the form of a string that names a particular fruit) and the float is the cost of that fruit. (feel free to look at the txt file and see what it contains) . . . Write a python program that: Reads in key/value pairs from the file into a dictionary. Lists the contents of the dictionary using the following format: - $ Make sure the value is a decimal value with 2 decimal places. Contains a function that provides the average of the values Output a statement that averages the value of all the fruit using the following format: The average cost of all the fruit is function call> . Sample Input Read from the file FruitDat.txt Sample Output apple - $2.99 $ pear $1.45 orange $3.19 grapes - $1.99 strawberries - $4.79 kiwi - $9.99 plum $2.15 mango $6.50 The average cost of all the fruit is $4.13. 8 apple, 2.99 pear , 1.45 orange, 3.19 grapes, 1.99 strawberries, 4.79 kiwi, 9.99 plum, 2.15 mango, 6.50

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 Databases Questions!