Fortune Teller¶
You can tell someone’s fortune by having them pick a number and then using if
statements to print the fortune for the number.
- 1
- It would have to at least check if it was 1 or 2.
- 2
- It executes every if, even if it already found the answer.
- 5
- It executes every if.
- 6
- There are only 5 logical expression here so it can't be more than 5.
csp-13-3-2: How many conditions (logical expressions) are checked if the user answered 2?
- 1
- It has to execute each if in order from top to bottom.
- 2
- How would this work?
- 5
- It executes every if.
- 6
- There are only 5 logical expression here so it can't be more than 5.
csp-13-3-3: How many conditions (logical expressions) are checked if the user answered 6?
Modify the program to handle when the user enters something other than a number from 1 to 5. Also add some additional fortunes and allow the user to pick a number from 1 to 10.
You have attempted of activities on this page