Skip to content

Instantly share code, notes, and snippets.

@bussiere
Created March 7, 2012 14:01
Show Gist options
  • Save bussiere/1993313 to your computer and use it in GitHub Desktop.
Save bussiere/1993313 to your computer and use it in GitHub Desktop.
petit script pour les horaires
def additionheure(heuredebut,heurefin):
tabdebut = heuredebut.split(":")
tabfin = heurefin.split(":")
ajout = 0
minute = int(tabdebut[1])+int(tabfin[1])
if minute >= 60 :
ajout += 1
minute = minute - 60
if minute < 10 :
minute = "O%d"%minute
heure = int(tabdebut[0])+int(tabfin[0]) + ajout
minute = str(minute)
heure = str(heure)
return "%s:%s"%(heure,minute)
def horaire(debut,fin="",pausemidi="1:00",total="7:45"):
plusmidi = additionheure(debut,pausemidi)
print additionheure(plusmidi,total)
print horaire("9:20")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment