Unit 3.3-3.4
Hack 1
-
algorithm: the algorithm describes the instructions to complete a task, which done by the graphic with a list of instructions to do
-
sequencing: order of how to do something
- Set item to number to search for
- Get next number in list
- If number = item, display "item found"
- If more numbers in list, go back to step 2
- Display "item not found
-
selection If the number = item, the algorithm selects the item.
-
iteration The iteration loops through the list to find all the numbers equal to the item
num1 = 5
num2 = num1 * 3
num3 = num2 / num1 * (9 % 2) * 4
result = (num3 % num1 + num2) % num3 * 3 / 5
print(result)
Notes
- set of instruction that accomplishes a task
- three part os algorithm: sequencing, selection, iteration
- sequence: allows an algorithm to make a decision based on if a condition is met
-
iteration: a loop and performing a task until a condition is met
-
arithmetic: addition, subtraction, multiplication, division, modulus
-
strings: ordered sequences of characters
- examples of strings in pseudocode:
- len(str)
- concat (str1, str2)
- substring(str1, str2, length)- returns a substring of consecutive character from str 1 starting at the character at position 'start' and containing 'length' character