#Q1a
#2
#3
#3
################################################################################
#Q1b
z = x

################################################################################
#Q1c
#3
#2

################################################################################
#Q1d

for i in range(10, 15):
    print(i)
    

################################################################################
#Q1e
print(clubs[1])

################################################################################
#Q1f
items[1] = "changed value"

################################################################################
#Q1g
for course in courses:
    print(course)
    
################################################################################
#Q1h

for sublist in L:
    print sublist[1]
    
################################################################################
#Q1i
s = 0
for temp in temps:
    s += temp
print(s/len(temps))    

################################################################################
#Q1j

for i in range(len(L)):
    L[i] *= 2
    
################################################################################
#Q1k
print(currencies["canada"])    

################################################################################
#Q1l
currencies["brazil"] = "real"

################################################################################
#Q1m
for k in d:
    print d[k]
    
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################

#Q2

#Error: can't add strings and integers

#["two", "four", "six"]

#"burgundy"

#"sage"

#{"heads": [2, 9], "tails": [2, 9]}

#Not applicable to Python 3 (would produce an error)

#Not applicable to Python 3 (would produce an error)

#Error: no such thing as subtring in Python



#Q3: run in Python



#Q4
def add_neighbours(L):
    if len(L) <= 1:
        return L[:]
    
    res = [L[0]+L[1]]
    for i in range(1, len(L)-1):
        res.append(L[i-1]+L[i]+L[i+1])
    res.append(L[-2]+L[-1])
    

#Q5

def difference(d1, d2):
    d = {}
    for k in list(d1.keys())+list(d2.keys()):
        if k in d1 and k in d2:
            if d1[k] != d2[k]:
                d[k] = (d1[k], d2[k])
                
#Q6
#O(n), O(n), O(n^2), O(n^2), O(log n), O(n^2) 

#For the last one:
     
#If it's linear time (i.e., time proportional to the length of the list) then the answer is #O(n^2). It is in fact linear time. If it's constant-time (which it's not, but sometimes
#that assumption is made, then the answer is O(n)


#Q7
def flatten(L):
    if type(L) != list:
        return [L]

    res = []
    for e in L:
        res.extend(flatten(e))
    
    return res
        

    
#Q8
import urllib
def get_bold_test(url):
  page = urllib.request.urlopen(url).read().decode("utf-8")
  
  res = []
  s = page.lower()
  
  i = 0
  while s.find(<b>, i) != -1
    start_b = s.find("<b>", i)
    end_b = s.find("</b>", start_b)
    res.append(page[start_b+3:end_b])
    i = end_b

  return res



