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()

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:

- Write exponentiation as a**b (Zelle, page 54)
- See Zelle 2.5.2 for prompting for input

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:

- Try to avoid unnecessary arithmetic operations and note that an exponentiation costs more than a multiplication. Quantities a and r don't have to be positive and don't have to be integers.
- Make sure to run your program with the following values: a=1, r=2, n=20; a=4, r=-1/2, n=10; a=-1, r=4, n=15;