### Presentation controls

• Press the arrow keys to control the slideshow.
• Press S to open the speaker/presenter window.
• Press F to enter full screen, and Esc to exit full screen.
• Press B to blank the screen.

# Algorithms

## Key questions

• What is an algorithm?
• How is an algorithm different from a program?

## As an algorithm

``````
set the maximum_so_far to the first number

for each other number:
if the next number is larger than maximum_so_far:
set maximum_so_far to the number

At the end, maximum_so_far contains the largest value
``````

## As an algorithm

``````
set the maximum_so_far to the first number

for each other number:
if the next number is larger than maximum_so_far:
set maximum_so_far to the number

At the end, maximum_so_far contains the largest value
``````

## As an algorithm

``````
set the maximum_so_far to the first number

for each other number:
if the next number is larger than maximum_so_far:
set maximum_so_far to the number

At the end, maximum_so_far contains the largest value
``````

## As an algorithm

``````
set the maximum_so_far to the first number

for each other number:
if the next number is larger than maximum_so_far:
set maximum_so_far to the number

At the end, maximum_so_far contains the largest value
``````

## As an algorithm

``````
set the maximum_so_far to the first number

for each other number:
if the next number is larger than maximum_so_far:
set maximum_so_far to the number

At the end, maximum_so_far contains the largest value
``````

## Python

``````
max_so_far = int(input("Type in a score: "))

for i in range(4):
score = int(input("Type in a score: "))
if score > max_so_far:
max_so_far = score

print("High score was", max_so_far)
``````

## Python

``````
max_so_far = int(input("Type in a score: "))

for i in range(4):
score = int(input("Type in a score: "))
if score > max_so_far:
max_so_far = score

print("High score was", max_so_far)
``````

## Python

``````
max_so_far = int(input("Type in a score: "))

for i in range(4):
score = int(input("Type in a score: "))
if score > max_so_far:
max_so_far = score

print("High score was", max_so_far)
``````

## Python

``````
max_so_far = int(input("Type in a score: "))

for i in range(4):
score = int(input("Type in a score: "))
if score > max_so_far:
max_so_far = score

print("High score was", max_so_far)
``````

## Python

``````
max_so_far = int(input("Type in a score: "))

for i in range(4):
score = int(input("Type in a score: "))
if score > max_so_far:
max_so_far = score

print("High score was", max_so_far)
``````

## Key questions

• What is an algorithm?
• How is an algorithm different from a program?