How About a Quiz?

quiz

Tomorrow, we will take another quiz.  The quiz is a handwritten assessment, meaning that you will not be able to use the computer to test your code.  Instead, you will write out your responses directly on the quiz sheet.  I will also provide notebook paper for you to use as scratch as you design your solutions.

The quiz has eleven (11) items.  The first six involve Python lists.  I will provide you with this list:

mylist = [100, 200, ‘Quizzes’, ’are’, ’Fun’, ’:)’]

and then ask you the  output of various lines of code that manipulate the list.  For example,

What is the output of this line of code?

print(mylist[2:3])

The result of course is [‘Quizzes’].  Remember that slicing results in a new list, not just the data item.

The rest of the questions are outlined below

  • Problem 7 asks for the code necessary to receive a list from the user and map it to the integers.
  • Problem 8 asks for a function that draws a square of a given size. (Hint: memorize drawSquare())
  • Problem 9 asks for a while-loop and counter that will display a range of numbers like 8 through 14.
  • Problem 10 provides a formula from Geometry and ask you to write a program that receives the values needs for the formula and displays the results (similar to the principle-interest problem from the exercise set).
  • Finally, problem 11 asks for the code needed to open a data file and display it;s contents.

To practice #11, I have provided a file on the HS APPS N: drive named secret1.txt.  Copy this file to your H: drive where you store your other Python programs and write a program – right now – that reads the lines in that file and displays my secret message :).  If you can do this, you’ll be fine on #11.

Remember that you will have to do this with only your pen or pencil tomorrow, not the computer, so you may need to study and memorize some stuff tonight.  I would definitely review our work with lists and files so that you will be prepared for those questions.

Good Luck!