### Python Programming - Summer 2016 - Nathan Hull

## Assignment #3 - Due: Wednesday, July 20th

1.) Doubles!!

In games with two dice (such as *Monopoly)*, rolling two 6-sided dice and getting the same side or number on both dice is called doubles. Write a program which first prompts the user for the number of sides to the dice (as "regular" dice have 6 sides, but D&D dice could have 10, 12, or 30 sides etc). Then you program should keep "rolling the dice" until it gets three sets of doubles. The program should tell the user how many "rolls" were required to get three sets of doubles with this pair of "dice"!

**Sample input:**

`How many sides on your dice? 6? 10? 12? 30? `**6**

**Sample output:**

`1. die number 1 is 5 and die number 2 is 3. `

2. die number 1 is 2 and die number 2 is 4.

3. die number 1 is 1 and die number 2 is 1.

4. die number 1 is 3 and die number 2 is 3.

You got a double (3).

`. . .
`

`Three sets of doubles! Finally! On try number 31! `

This program should be named as follows: *lastname_firstname_assign3a.py* (for
example, *shakespeare_will_assign3a.py*)

2.) Factorials

Factorials are used in many applications in mathematics as the result grows very quickly. So while 5! = 120, 10! = 3,628,800. Factorials are used to calculate permutations for example: n! represents the number of ways to arrange n distinct objects into a sequence (which is something that Hindu scholars had figured out in the 12th century.) The notation n! was introduced by Christian Kramp in 1808. See http://primes.utm.edu/glossary/xpage/Factorial.html or http://notaboutapples.wordpress.com/2009/07/07/zero-factorial/ for more information!

Your program should prompt the user for a positive number (an integer) up to 15 and then use a *while loop* to print out the result.

**Sample input:**

`Enter a number from 1 - 15: `**5**

**Sample output:**

`The factorial of 5 - which is written as 5! is 120.`

This program should be named as follows: *lastname_firstname_assign3b.py* (for
example, *shakespeare_will_assign3b.py*)

Submit all programs by posting the source file to NYU Classes

#### Notes about your program:

- Make sure your program includes a comment at the beginning with your name along with a brief synopsis of the program.
- You should use comments throughout the source code to explain key steps and calculations.
- Choose intuitive names for variables
- You should use blank lines where appropriate to make your program easy to read.
- Make sure that your program does not contain any syntax errors.
- Test your program to be sure that it runs the way that you expect and does not produce run-time errors.