Questions

  • True or False, modules are code that you import into your program for added

    functionality?

  • Give an example of using the math module.

  • How can you import all of module's functions into your program so you don't

    have to continually write name_of_module.function()?

  • What does immutable mean?

  • What is the difference between a list and a tuple?

  • What is the difference between a list and a dictionary?

  • How could you get the second-to-last item in a list?

  • Do all of the items in lists or dictionaries have to be the same data type?

  • Based on the following list, how could you get another list from index 2 to

    index 4?

[5, 2, 3, 6, 8, 2]
  • How could you check to see if 4 exists in the list above?

  • Using the code below, what is the value of right_answer?

right_answer = [4, 2]
wrong_answer = right_answer
wrong_answer[1] = 5
  • Using the code below, what is the value of spam?

green_eggs = 'yum'
spam = 'weird'
my_plate = green_eggs
green_eggs = spam
spam = my_plate
  • Suggest one way that you can avoid the problem of accidentally modifying a

    list you didn't mean to.

Last updated