Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = [1, 1, 2, 2, 3, 4, 4]
- last = x[0]
- count = 1
- for i in x[1:]:
- if i != last:
- print(f'number {last}: {count} times')
- last = i
- count = 0
- count += 1
- print(f'number {last}: {count} times')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement