Solution to Problem on Slide 3:
Essentially iterate through each cell in the array and each of the 3x3 cells around it and if it meets the conditions for survival. Keep a running number of surviving cells and the number of cells around each.
Solution to HW problem on Slide 4:
Essentially follow the instructions and use a list to do elementwise operations on the string
x = list(input('A'))
num = int(input('A'))
for i in range(num):
key = input('A')
key_int = int(key,16)
print(''.join(x))
ind1 = int(str(key_int)[1])
ind2 = int(str(key_int)[2])
print(ind1,ind2)
if int(str(key_int)[0]) %2 ==0:
a = x[ind1-1]
x[ind1-1] = x[ind2-1]
x[ind2-1] = a
else:
a = x[-ind1]
x[-ind1] = x[-ind2]
x[-ind2] = a
if i==0:
x = ['A'] +x + ['A','A']
x = [key[0]] + x + [key[2]]
ind = int(input('A'))-1
print(x[ind], ''.join(x))