def amountOfEvenDigits(x):
cnt = 0
while x > 0:
cnt += (1 - (x % 10) % 2)
x //= 10
return cnt
n = int(input("Input a number: "))
print("Amount of Even digits of number " + str(n) + " = " + str(amountOfEvenDigits(n)))
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
def amountOfEvenDigits(x):
cnt = 0
while x > 0:
cnt += (1 - (x % 10) % 2)
x //= 10
return cnt
n = int(input("Input a number: "))
print("Amount of Even digits of number " + str(n) + " = " + str(amountOfEvenDigits(n)))