Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- a = input('Enter numbers:')
- a = a.split()
- alist = list(a)
- new_numbers = []
- for n in alist:
- new_numbers.append(int(n))
- alist = new_numbers
- newlist = {}
- for i in alist:
- if i in newlist:
- newlist[i]+=1
- else:
- newlist[i] = 1
- list2 = list(newlist.keys())
- list3 = list(newlist.values())
- for x in range(len(list2)):
- if list3[x] > 1:
- print(list2[x],'occurs',list3[x],'times')
- if list3[x] == 1:
- print(list2[x],'occurs',list3[x],'time')
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement