
def solution(N):
binary_list = ""
while N != 0:
binary_list += str(N%2)
N //= 2
binary_list = (binary_list[::-1].split('1'))[:-1]
return len(max(binary_list))
def solution(N):
binary_list = list(format(N, 'b'))
count = 0
max = 0
for i in binary_list:
if i == '0':
count += 1
elif i == '1':
if count > max:
max = count
count = 0
return max
s = " A B "
s.split()
s.split(' ')
- split()는 공백이 몇개이든 상관없이 무조건 1개로 보고 처리한다.
-> 공백뿐만 아니라 탭과 엔터도 처리해줍니다.
- split(' ')는 공백을 1개씩 각각 따로 처리합니다.
binary_list = binary_list[::-1].split('1')
- 1과 1사이에 있는 0을 찾아야하므로 맨마지막 배열은 빼줬습니다.