python - Write a program to count the number of occurrence of digit in a number. Email ThisBlogThis!Share to TwitterShare to Facebook Reactions: Labs 2 Comments
This comment has been removed by the author.
ReplyDeletea=int(raw_input("enter the number "))
ReplyDeleteb=0
c=0
d=0
e=0
f=0
g=0
h=0
i=0
j=0
k=0
while a>0:
t=a%10
if t==1:
b=b+1
elif t==2:
c=c+1
elif t==3:
d=d+1
elif t==4:
e=e+1
elif t==5:
f=f+1
elif t==6:
g=g+1
elif t==7:
h=h+1
elif t==8:
i=i+1
elif t==9:
j=j+1
else:
k=k+1
a=a/10
print b
print c
print d
print e
print f
print g
print h
print i
print j
print k