#   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

Recommended Answers

All 4 Replies

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.

is there other to write this program?

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


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

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.