feat: Initial commit
This commit is contained in:
44
simulazioni/astrologia/main.py
Normal file
44
simulazioni/astrologia/main.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import csv
|
||||
|
||||
segni = {}
|
||||
somma = 0
|
||||
|
||||
with open("zodiaco.csv") as csv_file:
|
||||
csv_reader = csv.reader(csv_file)
|
||||
|
||||
for row in csv_reader:
|
||||
data_start = row[1]
|
||||
data_start = data_start.split("/")
|
||||
data_start = int(data_start[1] + data_start[0])
|
||||
|
||||
data_end = row[2]
|
||||
data_end = data_end.split("/")
|
||||
data_end = int(data_end[1] + data_end[0])
|
||||
|
||||
nome = row[0]
|
||||
|
||||
segni[nome] = {"start": data_start, "end": data_end, "goals": 0}
|
||||
|
||||
|
||||
with open("sportivi.csv") as csv_file:
|
||||
csv_reader = csv.reader(csv_file)
|
||||
|
||||
for row in csv_reader:
|
||||
data = row[1]
|
||||
data = data.split("/")
|
||||
data = int(data[1] + data[0])
|
||||
|
||||
goals = row[0]
|
||||
|
||||
for segno in segni:
|
||||
if segni[segno]["start"] < data < segni[segno]["end"]:
|
||||
segni[segno]["goals"] += goals
|
||||
somma += goals
|
||||
break
|
||||
|
||||
|
||||
for segno in segni:
|
||||
dati = segni[segno]
|
||||
barra = "*"*int((dati[goals] / somma) * 50)
|
||||
|
||||
print(f"${segno} (${dati['goals']}): ${barra}")
|
||||
Reference in New Issue
Block a user