Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('problem5.csv', 'r', encoding='utf8') as fh:
- text = fh.readlines()
- text
- head = text[0].strip().split(';')
- head.remove('')
- #print(head)
- shops = []
- for i in range(1,len(text)):
- shop = text[i].strip().split(';')
- shops.append(shop[0])
- shops
- prices = []
- for i in range(1,len(text)):
- y = text[i].strip().split(';')
- y_1 = list(map(int, y[1:]))
- prices.append(y_1)
- #print(prices)
- shops_prices = dict(zip(shops,prices))
- shops_prices
- for i in range(len(head)):
- for shop,price in shops_prices.items():
- min_value = min(shops_prices[shop])
- print(head[i],shop,min_value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement