Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions 12.26.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def prepare(f, export_list = []):
lines = f.readlines()
for line in lines:
export_list.append(line.split())
return export_list

def export(export_list, amount = 0, countries = []):
product = input('Ввести назву товару: ')
for list in export_list:
if product.title() in list:
countries.append(list[1])
amount += int(list[2])
if amount == 0:
print('Товар не знайдено')
export(export_list)
else:
product_info = {'countries': countries, 'amount': amount}
print(product_info)


if __name__ == '__main__':
f = open("hw/12.26.txt")
export_list = prepare(f)
export(export_list)
6 changes: 6 additions & 0 deletions 12.26.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Car Spain 1000
Airplane Italy 450
Car Ukraine 320
Ship Ukraine 240
Ship USA 115
Car Italy 410