Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions