Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. with open('problem5.csv', 'r', encoding='utf8') as fh:
  2.     text = fh.readlines()
  3. text
  4. head = text[0].strip().split(';')
  5. head.remove('')
  6. #print(head)
  7.  
  8. shops = []
  9. for i in range(1,len(text)):
  10.     shop = text[i].strip().split(';')
  11.     shops.append(shop[0])
  12. shops
  13.  
  14. prices = []
  15. for i in range(1,len(text)):
  16.     y = text[i].strip().split(';')
  17.     y_1 = list(map(int, y[1:]))
  18.     prices.append(y_1)
  19. #print(prices)
  20.  
  21. shops_prices = dict(zip(shops,prices))
  22. shops_prices
  23.  
  24. for i in range(len(head)):
  25.     for shop,price in shops_prices.items():
  26.         min_value = min(shops_prices[shop])
  27. print(head[i],shop,min_value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement