Code Signal: Intro=53/60
by 습관중독 <best 1> def validTime(time): h,m=map(int,time.split(":")) return 0<=h<24 and 0<=m<60 <best 2> import time as t def validTime(time): try: t.strptime(time, "%H:%M") except: return False return True <best 3> def validTime(time): lst = time.split(':') return int(lst[0]) in range(0, 24) and int(lst[1]) in range(0, 60) <my> def validTime(time): return (0 <= int(time[0:2]) < 24) and (0 <= int(time[3:5]) < 60)
10위 안에 있는 베스트 코드보다
내 코드가 더 간결하게 나왔다.
간혹 베스트와 같은 적 있었는데 내가 더 간결한 건 처음이다.
기쁘다.
블로그의 정보
습관을 애정한다
습관중독