This is the solution to Quiz 5: Problems - Python variables and assignment statements.

The following figure illustrates the grade distribution for this quiz.

Maximum possible points is 100.

This quiz aims at testing your basic knowledge of Python’s print function, and the how to string manipulation in Python. Don’t forget to push your answers to your remote repository by the end of quiz time. Push your quiz-5 file to quiz/5/ folder in your Github project. If you write your answers in Python scripts, put the script files in the same folder as well. If you feel uncertain about your answer, you can test your final codes on Jupyter or IPython command lines.

1.  Make a string from the following list, with one one-line of Python code.

mylist = ['The' , 'weather' , 'is' , 'rainy' , 'today' , 'and' , 'cold' , 'only' , '22' , 'F.']


" ".join(mylist)
'The weather is rainy today and cold only 22 F.'

2.  Are tuples mutable objects? Can they be redefined?

No. Yes.

3.  How do you define an empty dictionary?


empty_dict = {} 

4.  Write a dictionary representation of the following matrix.


sparseMatrixDict = { (0,3): 1 , (1,0): 2 , (2,1): 5 , (3,3): 3 }