Question: Complete the function temperatures in the t02_functions.py module. The module t02.py provides simple testing for this function. This function asks the user to input a

 Complete the function temperatures in the t02_functions.py module. The module t02.py

Complete the function temperatures in the t02_functions.py module. The module t02.py provides simple testing for this function.

This function asks the user to input a series of daily high temperatures until they enter a sentinel value. The function categorizes these temperatures and returns the category counts, and calculates and returns the overall average temperature. Some examples from executing t02.py:

cold_days, pleasant_days, hot_days, avg_temp = temperatures()

Temperature C (-500 to stop): 10 Temperature C (-500 to stop): 23 Temperature C (-500 to stop): 32 Temperature C (-500 to stop): -500 Cold days: 1 Pleasant days: 1 Hot days: 1 Average temperature: 21 C 

Requirements

This function must:

Use constants to define the temperature limits and the sentinel value

Prompt the user for the temperature inputs

Return, not print, the resulting values

Asks the user for daily high temperatures (in Celsiuss) from the keyboard. The function stops asking for temperatures when the user enters 500. The function returns: the total number of hot days (temperatures 28 or higher) the total number of pleasant days (temperatures 16 - 27) the total number of cold days (temperatures 15 or lower) the average temperature for all days (rounted down) Do all inputs and calculations in integer. Use: cold_days, pleasant_days, hot_days, avg_temp = temperatures ( ) Returns: cold_days - number of cold days (int.) pleasant_days - number of pleasant days (int.) hot_days - number of hot days (int.) avg_temp - average temperature of all days (int.)

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!