Exercise 1

Take in a number from the user (between -50 and 50) then output between which multiples of 10 the number is between and whether it is positive or negative. If the number is 0, simply output that the number was 0. If the number is a multiple of 10, output that the number was a positive/negative multiple of 10. If the number is not between -50 and 50, inclusive, then do nothing.

Example 1:

Enter a number: -37
Your number is negative and between -30 and -40

Example 2:

Enter a number: 40
Your number is a positive multiple of 10

Example 3:

Enter a number: 0
Your number is 0

Exercise 2

Take in a 5-character word from the user.
Then, convert the "word" to proper capitalization (first letter is capitalized, and the rest lowercase).

Example:

Enter a 5-letter word: hElLo
Your word is Hello.

Exercise 3

Get a character from the user, and display its integer equivalent. If it is a letter, print the opposite case. Additionally, print the integer equivqalent of the opposite case if applicable.

Example:

Enter a character: c
'c' in decimal is 99.
'C' in decimal is 67.

Enter a character: =
'=' in decimal is 61.

Exercise 4

Create a password guessing game where a user attempts to break your passcode based on hints. Using 4 integers, decide the relationship (less than, greather than, equal to, twice as much, etc) between any number of your integers. These relationships is what defines your passcode. For example, my passcode could be: num1 has to be greather than num2, num2 has to be less than num3 and num3 has to be equal to num4. The user is then prompted to enter 4 numbers and told whether each number fits your specifications or does not. A message is then prompted saying whether the user failed or succeeded.

Example:

Enter 4 numbers: 12, 2, 600, 4
The first number looks good!
The second number looks good!
The third number needs some fixing...
The fourth number needs some fixing...
Sorry you didn't break the code!

Enter 4 numbers: 12, 2, 6, 3
The first number looks good!
The second number looks good!
The third number looks good!
The fourth looks good!
Congrats! You broke the code! :)

(Challenge: Instead of integers, use floating point numbers)

pssst SI Leaders, this is a helpful example to slowly introduce loops if you'd like. The program does not have to terminate after every attempt, keep it going with a while.

Quiz!

quiz03