leandre.clochard 3 years ago
parent
commit
cc8b36ddf1
  1. 5
      algo.py
  2. 11
      lecture_csv.py

5
algo.py

@ -0,0 +1,5 @@
def distance(tup_1, tup_2):
mn = (tup_1[0]-tup_2[0])**2+(tup_1[1]-tup_2[1])**2+(tup_1[2]-tup_2[2])**2
return mn
print(distance((338, 4.2, 6.3),(128, 14.8, 14.8)))

11
lecture_csv.py

@ -7,13 +7,10 @@ def estBissextile(date):
else:
return False
def numeroJour(date):
"""renvoie un entier correspondant au numéro du jour correspondant (entre 1 et 365)"""
try:
day = datetime.datetime.strptime(date, "%Y-%m-%d")
print(estBissextile(date))
num_day = day.strftime('%j')
return int(num_day)
except(ValueError):
@ -32,7 +29,9 @@ def lecture(name):
return lst_return
lecture("jeuTests.csv")
def distance(tup_1, tup_2):
mn = (tup_1[0]-tup_2[0])**2+(tup_1[1]-tup_2[1])**2+(tup_1[2]-tup_2[2])**2
return mn
lst = lecture("jeuTests.csv")
dist = distance(lst[0][1],lst[1][1])

Loading…
Cancel
Save