Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

make changes to the existing code. take input in a function. In the interactive part, you will write the function toinputthe temperature then return...

make changes to the existing code. take input a function. In the interactive part, you will write the to input the temperature  that temperature to the calling program.
  1. b) In lab 2A you were asked to do the following: Add a message based on the windchill. You decide the message. As an example, if the windchill is between 0 and 20 degrees or below you might say "brrrrrr.......that's cold"; if it is between -1 and -20 you might say "Are we human flavored popsicles yet?"Move this whole code to a function. This function will need the temperature that you input. This function will also calculate the windchill and then print out the message.
  2. use this previous code

#Function print_table

#This function will print the tabular wind chill

#Input to function: none

#Output from function: none through the return statement

#Effect of cuntion: print table of temperatures and windchill indices

def print_table():

  print("This is the magical wind chill calculator! Enter a temperature in degrees "

        "Fahrenheit and a wind speed in MPH and see a wind chill value")

  print("See a sample below!")

  print("n")

  print(format("Temperature","20"),format("Wind Speed","30"),format("Wind Chill","30"),end='n')

  temp = 20

  wind = 19

  wct = 35.74 + 0.6215 * temp - 35.75 * wind**0.16 + 0.4275 * temp * wind**0.16

  print(format(temp,"<20,.2f"),format(wind,"<30,.2f"),format(wct,"<30,.2f"))

  temp = 0

  wind = 5

  wct = 35.74 + 0.6215 * temp - 35.75 * wind**0.16 + 0.4275 * temp * wind**0.16

  print(format(temp,"<20,.2f"),format(wind,"<30,.2f"),format(wct,"<30,.2f"))

  temp = -15

  wind = 25

  wct = 35.74 + 0.6215 * temp - 35.75 * wind**0.16 + 0.4275 * temp * wind**0.16

  print(format(temp,"<20,.2f"),format(wind,"<30,.2f"),format(wct,"<30,.2f"))

  print("n=====================================================================n")

#Function get_temp

#This function will input a tempertaure from the user

#and return the temperature to the calling function

#Input to function: None

#Output from function: returns the temperature input by the user

def get_temp():

#Function get_wind

#This function will input a wind speed from the user

#and return the wind speed to the calling function

#Input to function: None

#Output from function: returns the wind speed input by the user

def get_wind():

#Function calcWindChill

#This function will calculate the wind chill index

#Input to function: temperature and wind speed

#Output from function: returns the calculated wind chill

def calcWindChill(temp, wind):

#Function printWindChill

#This function will print the wind chill and the message

#Input to function: wind chill index, temperature, and wind speed

#Output from function: nothing through the return statement

#Effect of function: prints the temp, wind speed, and windchill index

#Prints a message

def printWindChill(wct, temp, wind):

def main():

  print_table()

  for index in range(5):

    print("n")

    temp_in = get_temp()

#insert call to function get_wind here

#Insert call tom function calcWindChill here

#insert call to function printWindChill here 

main()  

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question