What is an algorithm?
A step-by-step procedure to solve a problem
What does an IF statement do?
Runs code if a condition is true
What is a variable?
A storage location for data
What is a prodecure?
Named set of instructions
What is debugging?
Finding and fixing errors
True or False: All algorithms must be efficient
False
What is a loop?
Repeats a set of instructions
What is a list?
A collection of multiple values
Inputs that make procedures flexible
Identify error
print("Hello)
missing quote
Finiteness/Input/Output/Effectiveness
Iteration vs Selection
Iteration=loops, Selection=decisions
Are computer-generated random numbers truly random?
No they are pseudo-random
Sends back a value
What is a logic error?
Code runs but gives the wrong result
What is sequencing?
Executing steps in order
Predict output:
x=5
if x> 3:
print ("Hi")
Hi
Accessing position in a list (starts at 0)
What is input and output?
Input= data in, Output= result
An error that breaks the rules of the programming language
What is the difference between an algorithm and program?
Algorithm= plan, Program= coded implementation
Why are loops important in simulations?
They allow many repeated trials for accuracy
x=2
x=x+3
x=5
Why do programmers use libraries?
To save time and reuse reliable code
Which type of error is usually the hardest to detect and why?
Logic error because the program runs but gives incorrect output