Group 33 : Lab04_inlab

Group Members:
(Vinayak K, 150050098)
I pledge on my honour that I have not given or received any unauthorized assistance on this assignment or any previous task.
Percent contributed - 100%

(Shriram S B, 150050099)
I pledge on my honour that I have not given or received any unauthorized assistance on this assignment or any previous task.
Percent contributed - 100%

(Anubhaw Kuntal Xess, 150050100)
I pledge on my honour that I have not given or received any unauthorized assistance on this assignment or any previous task.
Percent contributed - 100%

Extra Credits:
	1. In python, tuples are immutable. So, there is no append function for tuple(since append changes the tuple object which cannot happen). But, using '+' operator two tuples can be added and it returns a new tuple with second argument appended to first(it is allocated space separately somewhere else and the old tuples stay unchanged) (binding means the varible can be used to refer to that object)
	>>>x = (1,2)      #creates a tuple instance and binds it to x
	>>>y = x + (3,)   #adds (appends 3 to x) the two tuples and allocates a separate space for the 
					     new extended tuple and binds the extended tuple to y
	>>>x = x + (3,)	  #this just rebinds x to the new extended tuple returned

	2.
	Observation:
	>>>li = [1, 2, 3]
	>>>tup = (1,2, li)
	>>>li.append(4)
	>>>print(tup)
	output: (1, 2, [1,2,3,4])
	That is the 4 gets appended to the list.

	Explanation:
	4 gets appended to the list. The list is changed but the tuple is not changed.
	
	A tuple stores reference to the objects inside it. For example, in tuple t = (1,2,3),
	t[0] stores reference to int object 1, t[1] - reference to int object 2 and same for t[2].
	>>>li = [1, 2, 3]	#creates a list object [1,2,3] and binds it to li
	>>>tup = (1, 2, li) #creates a tuple object and binds it to tup. 
	# tup[0] stores reference to int object 1
	# tup[1] to int object 2
	# tup[2] to the list object same as which li is bound to.
	>>>li.append(4)
	while appending the list li, tup is not changed. It still has three elements storing references to 'int object 1', 'int object 2', and the list object. It is just that the list object is changed. So, printing tup prints
	(1,2,[1,2,3,4])
	>>>b = [1,2]
	>>>tup[3] = b #this cannot be done because it tries to change tup[3] to reference to the list bound to b which is at a different location from [1,2,3,4]   

Citations:
	Task_B1:
		http://stackoverflow.com/questions/2612802/how-to-clone-or-copy-a-list-in-python
		https://docs.python.org/3.3/library/functions.html#zip

	Task B2:
		http://stackoverflow.com/questions/3121979/how-to-sort-list-tuple-of-lists-tuples

	Task B3:
		http://stackoverflow.com/questions/6583573/how-to-read-numbers-from-file-in-python
