butterflyTee 0 Light Poster

I WRITTEN THIS PROGRAMM IN 2 WAYS(RE-WROTE IT OVER AND OVER), AND ITS STILL NOT RUNNING CORRECTLY. IS THERE OTHER WAYS THAT IS PROGRAM CAN BE WRITTEN. I AM SO FRUSTRATED, PLEASE HELP ME. THANK YOU.

1st way:

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


from math import *

def windchill(t, v):
c = 35.74 + .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()

2nd way:

def windchill( vel, temp):
wc = 35.74 + .6215*temp - 35.75*(vel**.16) + .4275*temp*(vel**.16)
return wc

def main():
print (" __ __ __ Temperature \n")
print ("Speed \n")
print (" 1 -20 70 10 0 10 20 30 40 50 60 ")


for x in range(5, 55, 5):
print x
for y in range (-20, 70, 10):
chill = windchill(x,y)
print str(int(chill)) + " ",


print main()


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

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.