Question: USING PYTHON IDLE 3.4: Need help with this please! PLEASE USE PYTHON IDLE 3.4! Define a function named q4() that accepts a string as a
USING PYTHON IDLE 3.4:

Need help with this please! PLEASE USE PYTHON IDLE 3.4!
Define a function named q4() that accepts a string as a parameter. After verifying that the string includes only includes numeric digits, count the number of even (E) and odd (O) digits. Finally, create a new string made up of these values and their sum. Repeat this process until your end result is a string containing '123'. For example, '15327' contains 1 even digit (E = 1), 4 odd digits (O=4) and the sum of these is 5 (E+O). The new string would be "145'. Repeating the process (E = 1, O = 2, E+O = 3) gives me '123'. The function q4() should return the number of repetitions it takes to create the string 123 Example output of function q4() at the interactive Python prompt: >>> q4 ('123') 0 >>> q4 ('5') 2 >>> q4 ('471') 1 >>> q4 ('1234567890') 3 >>> q4 ('0') 2 Already '123' so takes zero repetitions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
