Hey guys! I have a serious problem. I missed class for computer science because I had two grandparents die in 2 weeks. My teacher has a no exception policy for turning in homework late.

Tonight has been my only free night to do homework but I am stuck and not sure what to do.

I have two problems to do for computer science and I have no idea how to do them. Can someone PLEASE HELP! I would be so gracious!

1. The national weather service computes the wind chill index using the following forumla.

Windchill (ºF) = 35.74 + 0.6215T - 35.75(V^0.16) + 0.4275T(V^0.16)

Where T is the temperature in degrees Fahrenheit and V is the windspeed in miles per hour. Write a program that prints a nicely formatted table of wind chill values. Rows should represent wind speed for 0-50 in 5 mph increments and the columns represent temperatures from -20 to 60 in 10 degree increments.

That is the first problem. I just don't know how to make a table.
Here is a link to the thing it should look like.

2. A positive whole number n > 2 is primed if no number between 2 and the square root of n (inclusive) evenly divides n. Write a program that accepts a value of n as input and determines if the value is prime. If n is not prime, your program should quit as soon as it finds a value that evenly divides n.

i have the basics written for this one.

def main():
n = input(Please enter your number:")


Otherwise I am not sure what to do. Any help would be awesome!!!!! PLEASEEEEEEEEEEEEEEE!!!!!

9 Years
Discussion Span
Last Post by adam1122

For the first problem, you can use two nested loops using the range function (http://www.network-theory.co.uk/docs/pytut/rangeFunction.html). The outer loop would be wind speed and the inner loop would be temperature.

Something like this:

for wind in range(...):
    for temp in range(...):
       #calculate and display value using wind and temp

Of course you will have to alter the range(...) part, which should be easy enough with the link above.

For problem 2, a loop can be used that iterates from 2 to sqrt(n). If the value of the loop evenly divides into n (n%i == 0), it's not prime.

I hope this helps because I'm exhausted and going to bed right now but I sympathize with your situation.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.