School of the Future Name:

Physics II Date:

Programming Exercise #3b: Opt-Out Task

For those of you familiar with Python, you may choose to opt-out of this assignment by demonstrating your understanding of and ability to collecting information from users.

TASK: Write a program that meets the following requirements. Once you have it successfully running, show Mr. Z and he will give you credit.

1.  It must have at least two comments

2.  It must have at least two variables (at least one string and one number)

3.  It must print at least four lines of “stuff”

4.  It must ask the user for at least two pieces of information.

5.  At least one of the pieces of information collected from the user must be a number that is then used in a subsequent calculation and reported back.

6.  Then complete the questions on the next page.

Below is an example of a program that meets the above requirements.

1.  What does the function time.sleep() do? Google it and find out.

2.  Researching Common Data Types & Type Casting

a.  There are many different data types that can be stored in variables. Below are the main ones we’ll be concerned with. Find out what each one is/means. Use Google or check out: http://www.tutorialspoint.com/python/python_numbers.htm

i.  int

ii.  float

iii.  string (str)

b.  When raw_input() is used and the user types something into the computer, it is saved as a string, regardless of what is typed. If we want to treat it like a number (in order to do addition, subtraction, etc.), it needs to be converted to an int or a float.

i.  Find out how to convert a variable to an int or float.

NEVER DOUBT THAT A SMALL GROUP OF COMMITTED INDIVIDUALS CAN CHANGE THE WORLD, INDEED IT IS THE ONLY THING THAT EVER HAS. MEAD