I have two lists like this:
monkey = ['2\n', '4\n', '10\n']
banana = ['18\n', '16\n', '120\n']
What I want to do with these two list is make a third list, let's call it bananasplit.
I have to strip away ' \n'
, leaving only values and then make a formula which divides into:
bananasplit[0] = banana[0]/monkey[0]
bananasplit[1] = banana[1]/monkey[1]
etc
I experimented with while-loop but can't get it right. Here is what I did:
bananasplit = 3*[None]
i = 0
while i <= 2:
[int(i) for i in monkey]
[int(i) for i in banana]
bananasplit[i] = banana[i]/monkey[i]
i += 1
How would you demolish this minor problem?