Programming Iteration

Cards (7)

  • The purpose of a trace table is so the programmer can check the proram to see if what they've written works behind what's being outputted.
  • A loop is an instruction that repeats itself until some condition is met.
  • To use a trace table, write down all possible inputs (in this case, any combination of two numbers), then work out the outputs by following the steps of the algorithm.
  • The while statement executes the body of code as long as a specified condition remains true
  • A for loop is used to repeat a set of instructions a set number of times.
  • When using range, there are three variables that can be inputted: the start, the stop, and the step.
    The start: tells the program what number to start from.
    The stop: tells the program what number to stop at however, it stops one number before that.
    The step: tells the program how much to increment the count by.
  • ValueError is when the program acknowledges the mistake of using the wrong data type in the code but stops the code running as a reult of the error.