944,125 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 2210
  • Python RSS
Apr 17th, 2006
0

Did I do the windchill index correctly.Due in 18hrs.Is there other ways to write this

Expand Post »
Python Syntax (Toggle Plain Text)
  1. # windchill.py
  2. # tpm
  3. # A program that prints a nicely formatted table of windchill values.
  4.  
  5.  
  6. from math import *
  7.  
  8. def windchill(t, v):
  9. c = 35.74 + (0.6215 * t) - (35.75 * v ** .16) + (.4275 * t * v ** .16)
  10. return c
  11.  
  12. def main():
  13. print "MPH:",
  14. for k in range (-20, 70, 10):
  15. print "%3d" %k,
  16. print
  17. print "_" * 44
  18. for velocity in range (5, 55, 5):
  19. print "%3d" %velocity,
  20. for temp in range (-20, 70, 10):
  21. chill = windchill(temp, velocity)
  22. print "%3d" %round(chill),
  23. print
  24.  
  25. main()
:o
Last edited by alc6379; Apr 17th, 2006 at 9:01 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
butterflyTee is offline Offline
43 posts
since Feb 2006
Apr 17th, 2006
0

Re: Did I do the windchill index correctly.Due in 18hrs.Is there other ways to write

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.
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003
Apr 18th, 2006
0

Re: Did I do the windchill index correctly.Due in 18hrs.Is there other ways to write

is there other to write this program?
Reputation Points: 10
Solved Threads: 0
Light Poster
butterflyTee is offline Offline
43 posts
since Feb 2006
Apr 19th, 2006
0

Re: Did I do the windchill index correctly.Due in 18hrs.Is there other ways to write this

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


:mad: :evil: :cry: :o
Reputation Points: 10
Solved Threads: 0
Light Poster
butterflyTee is offline Offline
43 posts
since Feb 2006
Apr 19th, 2006
0

Re: Did I do the windchill index correctly.Due in 18hrs.Is there other ways to write

Quote originally posted by butterflyTee ...
I WROTE 2 PROGRAMS FOR WINDCHILL, AND IT STILL NOT RUNNING CORRECTLY. I TRIED EVERYTHING.


:mad: :evil: :cry: :o
Um...

I just said it worked fine on my machine. What is the problem? What errors is the interpreter throwing?
Team Colleague
Reputation Points: 186
Solved Threads: 147
Cookie... That's it
alc6379 is offline Offline
2,519 posts
since Dec 2003

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Here Is Another Way I Wrote This Program Which Is Due
Next Thread in Python Forum Timeline: Printing





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC