Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv
- class time(object):
- def __init__(self,time):
- self.h=time[0]
- self.m=time[1]
- self.s=time[2]
- def addTime(self,other):
- self.m+=(self.s+other.s)//60
- self.s=(self.s+other.s)%60
- self.h+=(self.m+other.m)//60
- self.m=(self.m+other.m)%60
- self.h+=other.h
- def __str__(self): #string representation
- return "%d:%d:%d" % (self.h,self.m,self.s)
- def strToTime(str):
- str=str.split(":")
- for a in range(0,len(str)):
- str[a]=int(str[a])
- return str
- name, t1, t2 = argv
- time1=time(strToTime(t1))
- time2=time(strToTime(t2))
- time1.addTime(time2)
- print(time1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement