Syllabus: [pdf] [tex]

link to internal Fairmont State Jupyter notebook instance

Link for code using Turtle graphics

__Homework__

**Homework 1** (*due 21 January, graded 6 February*): Section 2.3 checkpoint: #2.7, 2.8, 2.9; Section 2.5 checkpoint: #2.11, 2.15; Section 2.6 checkpoint: #2.18 and the following problem:

*Problem A*: Think about three broad topics (e.g. music, etc) you are interested in. Write a program that asks the user to input their favorite example from each of those topics and display the results appropriately.

**Homework 2** (*due 28 January*): section 2.7 checkpoint: #2.19, 2.20, 2.21; ~~section 2.8 checkpoint: #2.23, 2.26, 2.27~~, and the following problem:

*Problem A*: Consider the ideal gas law from chemistry: $pV=NRT$, where $p$ represents pressure, $V$ represents volume, $N$ represents the amount of a substance, $R$ is the gas constant, and $T$ is the temperature. This equation can be algebraically rearranged to obtain $R=\dfrac{pV}{NT}$. Write a program to ask a user to input values for the variables $p$, $V$, $N$, and $T$ and then calculate and print the value of $R$ in response.

**Homework 3** (*due 4 February*): section 2.8 checkpoint: #2.23, and the following problems:

**Problem A**: *Modify* the following code by *only adding end and sep options* to the existing print commands to get the output A.B;C:E--

Here is the code to modify:

print("A","B")
print("C")
print("E")

**Problem B**: Use the turtle graphics package to make the turtle draw the first letter of your first name and the first letter of your last name, each in a different color. Be sure that the two letters are separated by a space and are not connected with a line.

**Homework 4** (*due 11 February*):

*Problem A*: Write a program that asks the user for a number. The program should respond with "positive" if the number is greater than 0, "negative" if the number is less than 0, or "zero" if the number is equal to zero.

*Problem B*: Write a program that asks the user for an integer between 1 and 10. The program should reply with the Roman numeral of that integer.

recall Roman numerals:
Integer | Roman Numeral |

1 | I |

2 | II |

3 | III |

4 | IV |

5 | V |

6 | VI |

7 | VII |

8 | VIII |

9 | IX |

10 | X |

*Problem C*: (A simple game) Write a program that asks a user to insert some number of pennies, nickels, dimes, and quarters. First, the program should tell the user how many total cents this is. If the total value of the coins is equal to one dollar (i.e. 100 cents), then the program should congratulate the user for winning the game. Otherwise, the program should display a message saying that the total amount is greater than or less than one dollar (depending on what was inserted).

**Homework 5** (*due ***20 February**):

*Problem A*: In mathematics, the notation $n!$ represents the factorial of the nonnegative integer $n$. The factorial of $n$ is the product of all the nonnegative integers from $1$ to $n$. For example,
$$4! = 1 \cdot 2 \cdot 3 \cdot 4 \cdot = 24$$
and
$$7! = 1 \cdot 2 \cdot 3 \cdot 4 \cdot 5 \cdot 6 \cdot 7 = 5040.$$
Write a program that lets the user enter a nonnegative integer then uses a loop to calculate the factorial of that number. Display the factorial.

*Problem B*: Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies.

*Problem C*: Write a program that predicts the approximate size of a population of organisms. The application should use text boxes to allow the user to enter the starting number of organisms, the average daily population increase (as a percentage), and the number of days the organisms will be left to multiply. For example, assume the user enters the following values:

Starting number of organisms: 2

Average daily increase: 30%

Number of days to multiply: 10

The program should display the following table of data:

Day Population
1 2
2 2.6
3 3.38
4 4.394
5 5.7122
6 7.42586
7 9.653619
8 12.5497
9 16.31462
10 21.209

**Notes from class**

16 January

21 January

23 January

28 January

30 January

4 February

6 February

11 February

13 February

**Other stuff**

Homework guidelines