You are viewing a single comment's thread. Return to all comments →
n = int(input().strip()) binary = format(n,'b') ones = 0 max_ones = 0 for zero_or_one in binary: if zero_or_one == '1': ones += 1 else: ones = 0 if ones > max_ones: max_ones = ones print(max_ones)
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →