Last active
August 24, 2018 06:39
-
-
Save s1s1ty/fdb5b234f5a4f4560e70e9f1142d0ac5 to your computer and use it in GitHub Desktop.
30-days-python-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
if __name__ == '__main__': | |
n = int(input()) | |
b = bin(n)[2:] # dec to binary | |
c = 0 | |
a = -1 | |
for i in b: | |
if i == '1': | |
c += 1 | |
a = max(a, c) | |
else: | |
c = 0 | |
print(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment