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

The following figure illustrates the grade distribution for this quiz.

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 }