Unit 3 Lesson 3-4 Hacks and Notes
Mathematical Expressions and Strings
Hacks:
3.3
- sequencing:
- Set item to number to search for.
- Get next number in the list.
- If number = item, display "item found"
- If there are more numbers in the list, go back to Step 2.
- Display "item not found".
- selection:
- If number = item, display "item found"
- iteration:
- If there are more numbers in the list, go back to Step 2.
Aritmetic Expression:
num1 = 5
num2 = num1 * 3
num3 = num2 / num1 * (9 % 2) * 4
result = (num3 % num1 + num2) % num3 * 3 / 5
answer is 3
Crossword Puzzle: 3 across: sequence 1 down: iteration 2 down: selection
Challenge Problem:
string1 = "degree"
string2 = " passenger"
FinalString = string1 + string2
print(FinalString[2:9])
print(len(FinalString))
print(len(FinalString[2:9]))
Quiz: