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

Thread Solved
Reply

Join Date: Feb 2006
Posts: 43
Reputation: butterflyTee is an unknown quantity at this point 
Solved Threads: 0
butterflyTee butterflyTee is offline Offline
Light Poster

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

 
0
  #1
Apr 17th, 2006
  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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

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

 
0
  #2
Apr 17th, 2006
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.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 43
Reputation: butterflyTee is an unknown quantity at this point 
Solved Threads: 0
butterflyTee butterflyTee is offline Offline
Light Poster

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

 
0
  #3
Apr 18th, 2006
is there other to write this program?
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 43
Reputation: butterflyTee is an unknown quantity at this point 
Solved Threads: 0
butterflyTee butterflyTee is offline Offline
Light Poster

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

 
0
  #4
Apr 19th, 2006
I WROTE 2 PROGRAMS FOR WINDCHILL, AND IT STILL NOT RUNNING CORRECTLY. I TRIED EVERYTHING.


:mad: :evil: :cry: :o
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

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

 
0
  #5
Apr 19th, 2006
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?
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC