You are viewing a single comment's thread. Return to all comments →
Python : took time to fix a silly miss in step if binnum[i] == '1' .. missed quotes
bin_num = '' temp_num = n while temp_num > 0: bin_num = str(temp_num % 2) + bin_num temp_num //= 2 count = 0 max_count = 0 i=0 for i in range(len(bin_num)): if bin_num[i] == '1': count += 1 if count > max_count: max_count = count else: count = 0 print(max(max_count, count))
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 →
Python : took time to fix a silly miss in step if binnum[i] == '1' .. missed quotes