Notes:

  • three parts of algorithm
    • sequencing
    • selection
    • iteration
  • arithmetic operations
    • addition
    • sbtraction
    • multiplication
    • division
    • modulus
  • strings
    • ordered sequences of characters
    • some procedures may exist that can be used with strings
    • each language has its own procedures, methods, and functions

Hacks:

3.3

  • sequencing:
  1. Set item to number to search for.
  2. Get next number in the list.
  3. If number = item, display "item found"
  4. If there are more numbers in the list, go back to Step 2.
  5. Display "item not found".
  • selection:
  1. If number = item, display "item found"
  • iteration:
  1. 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

3.4

Challenge Problem:

string1 = "degree"
string2 = " passenger"
FinalString = string1 + string2
print(FinalString[2:9])
print(len(FinalString))
print(len(FinalString[2:9]))
gree pa
16
7

Quiz: quiz photo