Question
I need help with this Python code here. Write a function named digit_count that takes one parameter that is a number (int or float) and
I need help with this Python code here.
Write a function named digit_count that takes one parameter that is a number (int or float) and returns a count of even digits, a count of odd digits, and a count of zeros that are to the left of the decimal point. Return the three counts in that order: even_count, odd_count, zero_count.
For example:
digit_count(1234567890123) returns (6, 7, 1) digit_count(123400.345) returns (5, 4, 2) digit_count(123.) returns (2, 2, 0) digit_count(0.123) returns (2, 2, 1)
Write a main function that will call your digit_count function with at least five examples and prints the results only if the module is invoked directly by the user.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started