0
#   windchill.py
#   tpm
#   A program that prints a nicely formatted table of windchill values.  


from math import *

def windchill(t, v):
    c = 35.74 + (0.6215 * t) - (35.75 * v ** .16) + (.4275 * t * v ** .16)
    return c

def main():
    print "MPH:",
    for k in range (-20, 70, 10):
        print "%3d" %k,
    print
    print "_" * 44
    for velocity in range (5, 55, 5):
        print "%3d" %velocity,
        for temp in range (-20, 70, 10):
            chill = windchill(temp, velocity)
            print "%3d" %round(chill),
        print

    main()

:o

2
Contributors
4
Replies
6
Views
11 Years
Discussion Span
Last Post by alc6379
0

Assuming the formula is right, looks basically fine to me. Just be sure to remove the spaces from the main() subroutine you call at the end, there. Good Job!

A handy tip:
Be sure to place [code][/code] tags around your code. It's especially important with Python, because the spaces actually are part of the code structure.

Edited by diafol: fixed formatting

0

I WROTE 2 PROGRAMS FOR WINDCHILL, AND IT STILL NOT RUNNING CORRECTLY. I TRIED EVERYTHING.


:mad: :evil: :cry: :o :sad: :(

0

I WROTE 2 PROGRAMS FOR WINDCHILL, AND IT STILL NOT RUNNING CORRECTLY. I TRIED EVERYTHING.


:mad: :evil: :cry: :o :sad: :(

Um...

I just said it worked fine on my machine. What is the problem? What errors is the interpreter throwing?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.