-
HW15 (last homework assignment)
(due date: Monday, December 8th, given at lecture 22):
p. 291 programming exercise 4 (only algorithm, but a thorough one) -
HW14
(due date: Wednesday, November 19th, given at lecture 18):
programming exercise 5 on page 262 -
HW13
(due date: EXTENDED TO Monday, November 17th, given at lecture 16, updated after lecture 17th):
programming exercise 4 on page 195,
and write at least two tests (as it is done in tests.py) for those functions (i.e. for sumN(n) and sumNCubes(n)) -
HW12
(due date: Monday, November 10th, given at lecture 15):
programming exersise 8, on page 161 -
HW11
(due date: Wednesday, November 5th, given at lecture 13):
Write a program that draws a house in Python, using the graphics.py library -
HW10
(due date: Monday, November 3rd, given at lecture 12):
page 119/6
note: the name is stored in a file.
The user will input the file name when the program is run (i.e. your program should ask the user to input the file name) -
HW9
(due date: Monday, November 3rd, given at lecture 11):
page 120/12 -
HW8
(due date: Wednesday, October 29th, given at lecture 10):
page 118 programming exercise 4.
Take care of the cases when a user inputs a number > 100 or a negative number, or inputs a character. The later one can be done with exception handling. -
HW7
(due date: Wednesday, October 22nd, given at lecture 9):
Write three programs that find the maximum of three numbers. The user will input the numbers from the keyboard. Use decision tree method, sequential processing and Pythons built-in function max. - HW6
(due date: Monday, October 20th , given at lecture 8):
Write a program that takes 14 numbers from the user. And outputs the sum of all negative numbers, the sum of all positive numbers and the averages of positive numbers, negative numbers and all fourteen numbers.
Hint: (use for loop; count negative numbers and positive numbers) at each iteration take the next inputted number
if it is negative – add it to the sum of all negative numbers, increment the counter of negative numbers
if it is positive – add it to the sum of all positive numbers, increment the counter of positive numbers
When the loop is over, you'll have a sum of all negative numbers, and the sum of all positive numbers, along with the numbers of negative and positive numbers. So it is clear how to find the averages. - HW5
(due date: Wednesday, October 8th , given at lecture 7):
- read Chapter Summary (section 3.7)
- Programming exercise (not from the book):
Based on the programs given in class improve the program that solves a quadratic equation.
Here is the algorithm for it:
input coefficients a,b,c
echo the resulting equation to the screen (i.e. display the quadratic equation on the screen)
find the Discriminant = b*b-4*a*c
if Discriminant is less then zero, then output to the screen that there are no real-number solutions of this quadratic equation
if Discriminant is equal to zero, then output to the screen that there is only one solution, and show the solution
if Discriminant is greater then zero, then output two solutions to the screen
- HW4
(due date: Monday, September 22nd, given at lecture 5):
- read Chapter Summary (section 2.8)
- p. 46 True/False (9-10)
Multiple Choice (6,8,10) - Programming exercise (not from the book)(use for loops):
Write a program that reads in twelve numbers and that outputs the sum of all the numbers.
- HW3
(due date: Wednesday, September 17th, given at lecture 4):
- read sections 2.3-2.5
- p. 46 True/False (4-8)
Multiple Choice (4) - Programming exercise (not from the book):
write a program that for any two numbers (let's denote them as a and b) finds their sum, their product, and the difference (a-b) between them. Numbers are taken from the user, results are displayed on the screen.
- HW2
(due date: Monday, September 15th, given at lecture 3):
- read section 2.1
- read section 2.2 (example of a program development process)
- p. 46 True/False (1-2)
Multiple Choice (1,3) - Programming exercise (not from the book):
using the stages of the software development process,
write a program that converts centimiters to inches.
(for the consultation refer to section 2.2 and example given in class)
- HW1
(due date: Wednesday, September 10th, given at lecture 2):
- p. 19, read section 1.9 Summary
- p. 20 True/False (5-10)
Multiple Choice (5-10)
Discussion (5) - Install Python on your computer
(see handouts or home page for information on installation) - p.22 (Programming exercises)
№ 1, 4 - for those of you who want to play more with Python
(not for grade, not for submission):
p. 22 (Programming exercises) № 5
- HW (not for grade) (given at lecture 1):
- p. 20 True/False (1,2,3,4)
Multiple Choice (1,2,3,4)
Discussion (1 (a,b), 2) - Install Python on your computer
(see handouts or home page for information on installation)
- p. 20 True/False (1,2,3,4)