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 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
Get step-by-step solutions from verified subject matter experts
