Questions

  • What is the difference between a while loop and a for loop?

  • How do you write a while loop?

  • How do you write a for loop?

  • What is a code block?

  • What is an infinite loop?

  • Is it possible to have an infinite for loop?

  • How do you exit an infinite loop if you're in one?

  • What does the range() function do?

  • Give a reason for why you might use the break or continue commands.

  • True or False, the pass command will skip everything until the end of the

    if statement below?

if condition == True:
  pass
  print("should this get printed")
  • Give an example of a 3-dimensional list.

  • True or False, the items in a list maintain the order of when they were added?

  • True or False, the items in a dictionary maintain the order of when they were added?

  • What does the enumerate function do?

  • Try printing out range(10) to see that iterating with numbers is really just

    creating a list to iterate over.

Last updated