Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input("Podaj liczbe n: "))
- b=1
- p = n%2
- n = n//2
- while(n>0):
- c = n%2
- if(c!=p):
- b=b+1
- p=c
- n=n//2
- print(b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement