Table of Contents

CS 190C, Spring 2009: Problem Set 1

Posted: Friday, January 16, 2009

Due: Friday, January 23, 2009, 10pm (electronic submission via Blackboard)

Each program should be in a separate file. Name your files problem1.py and problem2.py. Please use the following template for your programs.

# CS190C: Spring 2009
# FirstName LastName
# Problem Set 1, Problem 1
 
def main():
   #This is where your code should go
   print "Hello world."
 
main()

Problem 1

As of November 1, 2001, the National Weather Service uses the following formula to compute the wind chill temperature:

Given t, the temperature measured in degrees Fahrenheit, and v, the wind speed measured in miles per hour (at a height of about 33 feet), the effective temperature (the wind chill) is

\[ w = 35.74 + 0.6215t + (0.4275t-35.75)v^{0.16} \]

Write a program that prompts the user for two parameters, the temperature and the wind speed, and prints the wind chill (temperature and wind speed should be printed as well).

Note:

Problem 2

Use the range construct to evaluate the first n terms of a geometric series. Write a program that prompts the user for three inputs: a, r, and n, n >=0. Then, compute \[ a + ar + ar^2 + ar^3 + … + ar^n \] and output the computed quantity. Again, echo the input values read.

Comments: