• Submitted By: Jim-Sim
  • Date Submitted: 05/07/2015 4:17 PM
  • Category: Religion
  • Words: 582
  • Page: 3

Chapter 3
Complete coding questions 14, 15, and 16 from chapter 3. Each question should be commented and created as a self-named function (fourteen, fifteen, and sixteen) in a file called
14. Write a program that finds the average of a series of numbers entered by the user. As in the previous problem, the program will first ask the user how many numbers there are. Note: the average should always be a float, even if the user inputs are all ints.
15. Write a program that approximates the value of π by summing the terms of this series: 4/1 − 4/3 + 4/5 − 4/7 + 4/9 − 4/11 + . . . The program should prompt the user for n, the number of terms to sum, and then output the sum of the first n terms of this series. Have your program subtract the approximation from the value of math.pi to see how accurate it is.
16. A Fibonacci sequence is a sequence of numbers where each successive number is the sum of the previous two. The classic Fibonacci sequence begins: 1, 1, 2, 3, 5, 8, 13,. . .. Write a program that computes the nth Fibonacci number where n is a value input by the user. For example, if n = 6, then the result is 8.

Chapter 4
Please complete the coding questions 4, 10, and 11 at the end of the chapter. Each question is implemented as its own function using its numbered name (ex question 4 to be called four()) and all three functions to be included in one file called
4. Write a program that draws a winter scene with a Christmas tree and a snowman.

10. Triangle Information. Same as previous problem, but with 3 clicks for the vertices of a triangle.
9. Triangle Information. This program displays information about a triangle drawn by the user.
Input: 3 mouse clicks for the opposite corners of a triangle.
Output: Draw the rectangle. Print the perimeter and area of the triangle.

11. Five-click house.
You are to write a program that allows the user to draw a simple house using five mouse clicks. The first two clicks will...