Pseudo Code vs. a Python Algorithm
Pseudo Code is essentially describing/writing code in a more “human-written” format rather than formally/actually “coded” format.
Below are examples highlighting the key difference(s) between a coded (Python) algorithm against a College Board Pseudo Code example.
College Board Pseudo Code example
Below is an algorithm to find the largest number in a list of positive numbers.
- Set largest number to 0
- Get next number in the list
- If number is larger than largestNumber then set largestNumber to number
- If there are more numbers in list, go back to step 2
- Display largest number
largestNumber = 0
numberList = [5, 8, 3, 12, 7, 10]
for number in numberList:
if number > largestNumber:
largestNumber = number
print("Largest number:", largestNumber)
Largest number: 12