I have have two list and and I am trying to compare differences in $ amount over a certain amount.
the list are
file1 = ['file1,product1,-1000.56', 'file1,product2,500.43']
file2 = ['file2,product1,-1001.37', 'file2,product2,511.99']
I want to print the differences if over $5 in the below format
file1 product2 500.43
file2 product2 511.99
Difference = $11.56
Product 1 won’t display because it’s less than $5
Is there a good way to do this?
I have tried…
for i in file1:
i.split(",")
This works to get the list split out but how to I compare the two $ amounts, and display only $5 or more.
If someone could give me a way to compare the two $ amounts over $5 difference I can prob figure out the rest.
use
zip()to traverse over both lists: