Question: Read the instructions carefully and follow them exactly : - The only collections you can use are strings, tuples, and lists. You may not use
Read the instructions carefully and follow them exactly:
- The only collections you can use are strings, tuples, and lists. You may not use any other collection (such as a set or dictionary) in this assignment. Using any of these in a solution to a question constitutes changing that question. Consequently, that question will not be graded.
- If you get help from the Internet or from another person, you must cite the section of code you borrowed and the source. Failure to do so will result in a grade of 0 for the whole assignment. You may only borrow no more than 15% of your code.
- Global variables are not allowed.

Problem Five Problem Six Write a function listOilPricesBelowAveragePrice that takes the 'prices' 2D list and 'AveragePrice' as input. Now modify the code of the previous problem so the reportAvgOilPrice receives the 'prices' 1D list This function prints the details of all prices less than average in a table format as shown in the sample run. instead of a 2D list. The rest should be the same. Write the function reportAvgOilPrice that receives the 'prices' 2D list as a parameter and displays the The modified data structure: average gasoline price and call the listOilPricesBelowAveragePrice to list all countries that have a price below average price among all the countries given in the 2D list below. prices=[ 'Libya', 0.03, 'Africa', 'Turkey', 1.64, 'Asia', 'Qatar', 0.58, 'Asia'], 'Angola', 0.37, 'Africa', 'Nigeria', 0.42, 'Africa', 'Finland', 2.66, 'Europe', 'Venezuela', 0.02, 'South America', prices =[[ 'Libya', 0.03, 'Africa'], 'UK', 2.33, 'Europe'] ['Turkey', 1.64, 'Asia'], ['Qatar', 0.58, 'Asia'], Hint: you need to modify the function listOilPricesBelowAveragePrice to print the details of all prices ['Angola', 0.37, 'Africa'], above the average from a 1D list instead of a 2D list. ['Nigeria', 0.42, 'Africa'], ['Finland', 2.66, 'Europe'], The sample run should be the same. [Venezuela', 0.02, 'South America'] ['UK', 2.33, 'Europe']] In the main program, define your 2D list and make sure that you pass the correct parameter(s) to your function reportAvgOilPrice and capture any returned values appropriately if any. Sample run: The average price of gasoline is 1.00625 Dollars per liter. Countries with gasoline prices below 1.00625 USD dollar: Libya (Africa) gasoline price =0.03 Qatar (Asia) gasoline price =0.58 Angola (Africa) gasoline price =0.37 Nigeria (Africa) gasoline price =0.42 Venezuela (South America) gasoline price =0.02
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
