by CodeChum Admin
To give you more of a challenge with a number's digits, let's try counting how many of a certain digit is present on a given number.
Let's start coding!
Instructions:
Input
A line containing two integers separated by a space.
2·124218
Output
A line containing an integer.
2
digit, num = map(int, input().split())
count = 0
while num:
if num % 10 == digit:
count +=1
num = num // 10
print(count)
Comments
Leave a comment