Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In python with explanation please. 4. Write a function extractInt() that takes a string as a parameter and returns an integer constructed out of the
In python with explanation please.
4. Write a function extractInt() that takes a string as a parameter and returns an integer constructed out of the digits that appear in the string. The digits in the integer should appear in the same order as the digits in the string. If the string does not contain any digits or an empty string is provided as a parameter, the value O should be return. The following shows several sample executions of the function: Python 3.6.2 Shell - O X File Edit Shell Debug Options Window Help >>> extract Int ('1, 2, 3 ... we have been counting') 123 >>> val = extractInt(' Testing 1. Testing 12. Testing again!!") >>> val 112 >>> val * 2 224 >>> extract Int ("1 2 3 o'clock, 5 6 7 o'clock, 8 9 10 o'clock") 1235678910 >>> extractInt('no digits -- hou sad!") >>> extractInt('"') >>> | Ln: 69 Col: 4Step 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