Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part C: Digit Count Write a function named digit_count that takes one parameter that is a number (int or float) and returns a count of

image text in transcribed
Part C: Digit Count 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 point conversion 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) digit_count (123.) returns (1, 2, 0) digit count (.123) returns (0, 0, 0) Part C: Digit Count 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 point conversion 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) digit_count (123.) returns (1, 2, 0) digit count (.123) returns (0, 0, 0)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions