Hello,

I have a question pertaining to Python. I have been using the online book "How To Think Like A Computer Scientist" and have been doing the questions at the end of the chapters.

I cannot figure out how to modify "num_digits" so that it works as expected.I have tried and cannot seem to get it to work. I had been working pretty well in Python up to this point. I am given this:

[def num_even_digits(n):
"""
>>> num_even_digits(123456)
3
>>> num_even_digits(2468)
4
>>> num_even_digits(1357)
0
>>> num_even_digits(2)
1
>>> num_even_digits(20)
2
"""]
Any help would be appreciated.

Thanks!

Note the name of the function:
num_even_digits
It works correctly. You are calling the wrong function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.