Name: _______________________________________________

Directions: The quiz is CLOSED-PERSON (NO WANDERING EYES), open-book, open-note, open-internet, open-python-interpreter, and you may type all your answers on the computer. If you type your answers, then please be sure to print out your quiz and hand it in. If you are caught cheating, you will receive a zero on your quiz. You have until the end of the period to complete the quiz. Once you have completed the quiz, you may surf the Internet quietly. If you disrupt others, then your computer will be shutdown.

  1. Create a list variable named schools which contains the following strings: "Washington-Lee", "Yorktown", and "Wakefield"






  2. Write the print statement that outputs "Washington-Lee" using the list variable schools above. You must access the list when doing this.






  3. Using your list variable schools, change "Washington-Lee" to "W-L"






  4. Print out the slice of the list that just contains "W-L" and "Yorktown"






  5. Write a loop that prints each of the elements in the list 3 times. The output should look something like this:

    W-L W-L W-L
    Yorktown Yorktown Yorktown
    Wakefield Wakefield Wakefield






  6. Assume you have another list named otherSchools with the following strings: "Edison", "Falls Church", "Mount Vernon", and "Stuart". Create a list variable called nationalDistrict that combines schools and otherSchools.






  7. How would you remove/delete "Falls Church" from nationalDistrict?






  8. Assume that nums contains the following: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    Write a program that traverses nums with a loop and adds up all the numbers and prints out the total.






  9. **NON-IB STUDENTS MAY ATTEMPT THE FOLLOWING IB PROBLEM (#9) FOR EXTRA CREDIT**
    **IB STUDENTS ARE REQUIRED TO ANSWER THE FOLLOWING PROBLEM (#9)**

  10. Assume that you are given the following function:

    #deleteMin() finds the minimum element in a list, deletes it, and returns its value
    def deleteMin(myList):
      i = 0
      currentMin = myList[0]
      currentMinIndex = 0
      while i < len(myList):
        if myList[i] < currentMin:
          currentMin = myList[i]
          currentMinIndex = i
        i = i+1
      del myList[currentMinIndex]
      return currentMin

    1. Copy and paste the function definition to the top of your program
    2. Create a list named oldList with the following numbers: 1, 2, 4, 1, 45, 78, 5, 2, 43, 6, 20
    3. Create an empty list and store it in a variable named: newList
    4. Write a program that repeatedly (loop!) uses the deletMin(oldList) function to remove the smallest number from oldList. Every time you delete a minimum, add or append the returned value to newList
    5. After your loop has deleted everything from oldList, print out newList. What did your program do?!?

    PLEASE PASTE YOUR PROGRAM HERE