Question: IN PYTHON (Please dont use complicated code) Write a function named digit_count that takes one parameter that is a number (int or float) and returns
IN PYTHON (Please dont use complicated code)
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. Be careful of the edge case where the number starts with a decimal pointconversion of such a number to a string places a zero before the decimal point. See correct behavior in the final test case below. For example: digit_count(1234567890123) returns (5, 7, 1) digit_count(123400.345) returns (2, 2, 2) print(digit_count(123.)) returns (1, 2, 0) print(digit_count(.123)) returns (0, 0, 0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
