4 nouveaux défis
This commit is contained in:
16
Calcul des jours magiques.py
Normal file
16
Calcul des jours magiques.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import datetime
|
||||
|
||||
days = (len("lundi"), len("mardi"), len("mercredi"), len("jeudi"), len("vendredi"), len("samedi"), len("dimanche"))
|
||||
d = datetime.datetime.strptime("01/01/2000", "%d/%m/%Y")
|
||||
end = datetime.datetime.now()
|
||||
|
||||
ctr = 0
|
||||
while True:
|
||||
if (days[d.weekday()] + d.day)%10 == 0:
|
||||
ctr += 1
|
||||
|
||||
d = d + datetime.timedelta(days=1)
|
||||
if d > end:
|
||||
break
|
||||
|
||||
print(d, ctr)
|
||||
Reference in New Issue
Block a user