feat: Initial commit

This commit is contained in:
2024-03-22 17:01:42 +01:00
parent 954985f39a
commit c343ff6e93
106 changed files with 143428 additions and 1 deletions

30
Laboratorio10/vendite.py Normal file
View File

@@ -0,0 +1,30 @@
from sys import exit
def main():
try:
fio = open("vendite.txt", "r")
except FileNotFoundError:
exit("File not found")
datas = {}
for line in fio:
data = line.split(";")
if len(data) != 4:
exit("Invalid line: " + line)
service = data[1].strip()
cost = float(data[2].strip())
if service not in datas:
datas[service] = 0
datas[service] += cost
for key in datas:
print(key + ":", datas[key])
fio.close()
main()