Created
March 7, 2012 14:01
-
-
Save bussiere/1993313 to your computer and use it in GitHub Desktop.
petit script pour les horaires
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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