s = input("") s = s.strip("") hh, mm = s.split() hh = int(hh) mm = int(mm) hh += 2 mm += 30 if mm >= 60: mm -= 60 hh += 1 if hh >= 24: hh -= 24 print("{0:02}:{1:02}".format(hh, mm))
你可以試著用map函數
前面的可以簡化成 hh,mm=map(int,input().split())
就不用打那麼多行