Functions and Classes in Python

Solutions

1

In [21]:
a = [2, 4, 6, 8]
In [22]:
b = [10, 20, 30, 40]
In [23]:
a[2] == 6 and b[-1] == 40
Out[23]:
True

2

In [24]:
for i in range(0,len(a)):
    print(a[i] * b[i])
20
80
180
320

In [25]:
c = []
for i in range(0,len(a)):
    c.append(a[i] * b[i])
print(c)
[20, 80, 180, 320]
In [26]:
c[-1] == 320
Out[26]:
True