Skip to content

Instantly share code, notes, and snippets.

@s1s1ty
Last active August 24, 2018 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1s1ty/fdb5b234f5a4f4560e70e9f1142d0ac5 to your computer and use it in GitHub Desktop.
Save s1s1ty/fdb5b234f5a4f4560e70e9f1142d0ac5 to your computer and use it in GitHub Desktop.
30-days-python-code
#!/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