THIS WINDCHILL TABLE PROGRAM IS RUNNING, BUT THE NUMBERS IS STILL NOT LINING UP STRAIGHT..WHY, CAN YOU PLEASE HELP ME..THANKS


HERE IS THE PROGRAM BEFORE I RUN IT..

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 (60, -30, -10):
            chill = windchill(x,y)
            print str(int(chill)) + " ",
       



main()

AND HERE IS THE RESULTS AFTER I RUN IT...SEE THE NUMBERS IS NOT LINE UP STRAIGHT..

__ __ __               Temperature 

Speed 

 1 -20 70 10 0 10 20 30 40 50 60 
5
59  48  36  24  12  1  -10  -22  -34  10
58  46  33  21  8  -3  -15  -28  -40  15
57  44  31  19  6  -6  -19  -32  -45  20
56  43  30  17  4  -8  -21  -35  -48  25
56  42  29  16  2  -10  -24  -37  -50  30
55  42  28  14  1  -12  -25  -39  -53  35
55  41  27  13  0  -13  -27  -41  -54  40
54  40  26  13  0  -14  -28  -42  -56  45
54  40  26  12  -1  -15  -29  -44  -58  50
54  39  25  11  -2  -16  -31  -45  -59

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

Hi butterflyTee,

Please check your PM inbox.

To get the numbers to line up, you are going to need to use a formatting modifier to your print statement. Try something like:

print str("%3d" %int(chill))+" ",

instead of the print statement you have in your nested for-loop. This should space the numbers properly.

This question has already been answered. Start a new discussion instead.