Check Yourself

What does it mean for a program to terminate?

 View/hide answer

Either the program will return a value, or throw an exception. A program that does not terminate runs indefinitely, typically because it's gotten stuck in a loop.

 

What is a for loop?

 View/hide answer

A for loop takes some sort of iterable object (a list, tuple, or string) and performs its function once for each item in that object. Any function that depends on the input can have a different result at each step, since the input is the current item.