Question: Write a function named generate _ temperatures that works with the code below. The function should generate and print random temperatures between the coldest temperature
Write a function named generatetemperatures that works with the
code below. The function should generate and print random temperatures between the coldest
temperature and the hottest temperature until a temperature is generated that is close enough to
the desired temperature. Your program can make the following assumptions: the values of
all four parameters are floating point numbers, the coldesttemperature is less than the
hottesttemperature, the desiredtemperature is somewhere between the coldesttemperature
and the hottesttemperature and howclose is or greater.
def main:
c oldesttemperature
# The coldest temperature could be any value
hottesttemperature # The hottest temperature could be any value
desiredtemperature # A subjective ideal temperature could be any value
howclose
# Closeness to desired temperature could be any value
generatetemperaturescoldesttemperature, hottesttemperature,
desiredtemperature, howclose
main
What follows is a sample run that generates four random temperatures before stopping. The run
stops because the temperature is within degrees of the desired temperature.
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
