Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Examine the starter code in the editor window, and run the code in the interpreter. The function extract _ even _ numbers _ in _

Examine the starter code in the editor window, and run the code in the interpreter.
The function extract_even_numbers_in_list extracts the elements of a list that are even. The list my_evens has been created by calling this function on my_list. Inspect the data in my_evens.
In the code editor:
Create a new list called my_evens2 by using a list comprehension that does the same thing as extract_even_numbers_in_list, but all in one line.
The function extract_digits_from_string extracts the characters in a string that are digits. In this function, the method string.is_digit is used to test whether or not a string is a digit (or collection of digits). The list str_digits has been created by calling this function on the supplied string s. Inspect the data in str_digits.
Create a new list called str_digits2 by using a list comprehension that does the same thing as extract_digits_from_string, but all in one line.
Before testing your code for correctness with the button below, run %run exercise.py in the terminal to ensure the file runs with no errors. If there are errors, use the information from them to debug your code.

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

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago

Question

9. Describe the characteristics of power.

Answered: 1 week ago