time conversion1 [HackerRank] 01. Time Conversion def timeConversion(s): hour, minute, rest = s.split(':') second = rest[:2] ampm = rest[2:] if (ampm == 'PM') and (int(hour) != 12): hour = str(int(hour) + 12) elif (ampm == 'AM') and int(hour) == 12: hour = '00' return '{}:{}:{}'.format(hour, minute, second) if __name__ == '__main__': s = input() result = timeConversion(s) print(result) 2020. 3. 9. 이전 1 다음