Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # by Patrick Felix
- # number of occurrences of digit 2 between 0 and n-1
- def count2(n):
- aux = 0
- for each in range(0, n):
- xtwo = str(each).count('2')
- aux += xtwo
- return aux
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement