Question: Write the Python code for the function getEvenCount(num), where num is an integer. The function returns the number of even-valued digits in num. 0,

Write the Python code for the function getEvenCount(num), where num is an 

Write the Python code for the function getEvenCount(num), where num is an integer. The function returns the number of even-valued digits in num. 0, 2, 4, 6, and 8 are even digits. You are not allowed to use str(num), lists or tuples. The argument num is guaranteed to be an integer only. so num//10 will not behave as you expect it when num is negative. 145/10-14 but -145/10 returns -15. Make sure your code code handles negative numbers correctly. You cannot use recursion. Examples: getEvenCount(937825172500016) returns 7 getEvenCount(11351) returns 0 getEvenCount(-527888123) returns 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a Python method that satisfies your needs def getEvenCountnum If the number is negative make ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!