Exercises
August 30 - September 1, 2006
- Assign the value 9 to the variable my_num
Assign the value “17” to the variable my_string
Print my_num+my_string
What happens?
Assign the value 17 to the variable my_string
Print my_num+my_string
What happens?
Assign the value “print” to the variable print_var
What happens?
- Determine the results of the following:
1. 5+9/4*3-2
2. (5+9)/(4*(3-2))
3. 5**2+1/4-4
4. 5**(2+1)/(4-5)
5. 5**(2+1)/(4-4)
6. ((4-2)/(3-8)
7. ((5+3)/3(2+1))
- Execute the following statements:
1. print “\tName: Bob”
2. print “\t Name:\n Bob”
3. print “Name:\a Bob”
4. print “\a”*10
- Write the algorithm for a program that prompts the user for two integers
and displays the sum, difference, product, and quotient of the numbers.
- Write a program that implements the algorithm you wrote for exercise
4.
- Write the algorithm for a program that stores your name, age, street
number, street name, city, state, and zip code in separate variables
and the displays the data in the following format:
My name is : Mickey Mouse
My age is: 75
My address is: 1234 Main Street, San Francisco, CA 94121
- Write a program that implements the algorithm you wrote for exercise
6.
Sami Rollins