 Questions Don't wait any longer to start homework 3 Tuples list: sequence of arbitrary elements, elements can be added, removed, overwritten (mutable) string: sequence of characters (single letters or symbols), elements are fixed (immutable) tuple: sequence of arbitrary elements, elements are fixed (immutable) a_list = ["a", "b", "c"]a_str = "abc"a_tuple = ("a", "b", "c") tuples: can vs can't do Why? efficiency (technical reasons are beyond the scope of this course) safety for example, if you are representing locations in latitude and longitude, this data should always come in pairs Scope Mystery x = 5def square(x): x = x * x return xy = 10print(square(y))print(y)print(x) what if we remove x=5 the scope of a variable refers to the part of a program where that variable exists Practice def cube(x): x2 = x * x x = x2 * x return xfor num in range(4): if x % 2 == 0: x = cube(num) print(x)print(num)print(x)print(x2) Aliasing Mystery vec = [5,5,5]q = vecq = 7print(vec) vec = [5, 5, 5]q = vecvec = [1, 2, 3]print(q) def zero(vec): for i in range(len(vec)): vec[i] = 0vec = [1,2,3]print(zero(vec)) looking at these examples with pythontutor.com, we can see that the immediate value of a list variable in memory is an arrow to the actual list when we assign a new variable to a list or give a list as input to a function, it's this arrow that is used alias.py name = "Aaron"first_name = "Aaron"print(id(name))print(id(first_name))print(id("Aaron"))name = name + "!"print(name, id(name))print(first_name, id(first_name))print("mutable example:")ys = [1, 2, 3]xs = [1, 2, 3]print("ys", id(ys))print("xs", id(xs))ys.append(5)print("ys", ys, id(ys))print("xs", xs)zs = ysprint("zs", id(zs))def append10(nums): print("nums", id(nums)) nums += append10(ys)print("ys", ys, id(ys))def add10(num): print("num", num, id(num)) num += 10 print("num", num, id(num))a = 5print("a", a, id(a))add10(a)print("a", a, id(a))