## CIS 40

### Unit 3 Assignment

Write a script that asks the user for various data, stores the data, performs various operations on that data and outputs the results, as follows:

1. Display the user's name.
1. Prompt the user for their name and store the result in a variable named yourName.
2. Display (output) a greeting that says "Hello name", where name is in the variable yourName.
2. Data types
1. Store the value 10 in a variable named whatAmI.
2. Display the type of variable whatAmI.
3. Store the value 1.5 in the whatAmI variable.
4. Display the type of variable whatAmI.
5. Store the value "Hi" in the whatAmI variable.
6. Display the type of variable whatAmI.
3. Numbers
1. Prompt the user for a number and store the result in a variable named num1. Hint: don't forget to convert the input string into an int. (Enter 5 when prompted).
2. Prompt the user for a second number and store the result in a variable named num2 (Enter 3 when prompted).
3. Subtract num2 from num1 and display the result in the following format: 5 - 3 = 2
4. Divide num2 by num1 and display the result in the following format: 3 / 5 = 0.6
5. Raise num1 to the power of num2 and display the result in the following format: 5 ** 3 = 125
6. Multiply num1 by num2 to the power of num2 and display the result in the following format: 5 * 3 ** 3 = 135
7. Calculate num1 mod num2 and display the result in the following format: 5 % 3 = 2
8. Show these number exercises to the instructor.

OPTIONAL CHALLENGES: If you would like to extend the basic lab, some possible enhancements are listed below. These are simply for your learning and enjoyment, not for extra credit. You may do any or all of the challenges.

1. A store charges \$10.00 for a case of soda (24 cans). They are having a 20% off sale, but the consumer must pay tax of 10% and a can deposit of \$.05 per can (there is no tax or discount on this deposit charge). Calculate and display the final price the consumer pays for the soda.
2. A different store has a lower price where the final price the consumer pays for the soda is only \$8.00. The consumer has \$50 and wants to buy as many cases of soda as they can (they cannot buy partial cases). What is their change? Hint: use the mod function.
3. Given the information in B) above, how many cases of soda can the consumer buy? Hint 1: one approach is to use the fact that you know how much change there is and can therefore determine what was spent. Hint 2: a second approach is to use the floor division operator, //. Floor division is essentially division in which you round down the answer.