02 Windchill


Your first assignment is to write a program that computes the windchill factor for a given temperature and windspeed and prints a well formated table for a range of temperatures and wind speeds. This program will exercise your understanding of

  • functions 
  • mathematical computations
  • looping structures using for loops
  • output formating
  • proper coding structure and style


The National Weather Service computes the windchill index using the following formula:

    35.74 + 0.6215 * T - 35.75 * V0.16 + 0.4275 * T * V0.16
T is the temperature in degrees Fahrenheit, and V is the windspeed in miles per hour. Write a program that prints a nicely formatted table of windchill values. Rows should represent wind speed from 5 to 50 in 5mph increments, and columns represent temperatures from -20F to 60F in 10 degree increments. Your program must print proper row and column headings.

Version 1

Specifically your program must do the following:

  1. use a function called windchill(T,V) that takes a temperature T and windspeed V and returns the computed windchill factor.
  2. output a well formatted table 
  3. You may only use the def, print, forrange, and round functions.

 Sample Output

Version 2

Now modify your program to 

  1. Ask the user for start, stop, and increment values for both wind speed and temperature.
  2. Build a customized table, similar to above, but with the wind speeds and temperatures customized to the values entered by the user.
  3. The program must pause and ask the user to press ENTER before quitting.
  4. To the previous allowed functions, you can now also use input.

Version 3

Now modify your program to
  1. Comply with the code structure guidelines required by course.
  2. Include the following doctests to ensure that your windchill function is working properly.
    >>> windchill(5,10)
    >>> windchill(20,20)
    >>> windchill(-10,50)