Notes

Sequence: a list of steps to achieve result

selection: allows an algorithm to make a decision based on if a condition is met

iteration: doing a loop over again until condition is met

Hack 1

  • All the numbers are sequencing because they are the steps to achieve result
  • 3 & 4 are selection because it means allowing an algorithm to make a decision based on if a condition is met
  • 2 & 4 are iteration because it means a loops is made many times until condition is met

    Notes

    Example with Use of MODULUS

num1 = 12
num2 = 25
num3 = 14
result = num1 / 4 * num3 + 9 % 2 - num3
print(result)

The output of the result is 29

Hack 2

num1 = 5
num2 = num1 * 3 
num3 = num2 / num1 * (9 % 2) * 4 
result = (num3 % num1 + num2) % num3 * 3 / 5 
print(result)

The output of the result is 3

1 down - iteration

2 down - selection

3 across - sequence

Notes

This is an example of a len substring in python:

len(“HelloWorld”) The output is 10 because there are 10 letters in the string

This is an example of a concat string in python:

string1 = “Hello”

string2 = “World”

print(string1 + string2)

The output is HelloWorld

“Challenge” problem:

(The first to answer the output.)

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

The outputs are gree pa, 16, and 7

Hack 3

Picture 1.png