Question: Preview of README.md The original python int() function is great, but it has some shortcomings: One shortcoming is that your entire program will crash if

 Preview of README.md The original python int() function is great, but

Preview of README.md The original python int() function is great, but it has some shortcomings: One shortcoming is that your entire program will crash if you give it a string that contains non-numeric characters. Another one is that if you want to convert 12.34' to a string, int() will cause an error.. wouldnt it make more sense for it to just return the int portion, namely, 12? Well your job is to create a function called my_int() that takes a variable of type 'str as a parameter and returns an integer with the value in the string. If the string contains any characters that are not a number (except a period for a decimal), simply return None NOTE: You may not use the int() function within your implementation! Example Input *123" Example Output 123 Example Input 2 *123.56" Example Output 2 123 Us 05:04

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!