Python help, please show all steps and include comments Write a function numStrs() that takes a list of strings as a parameter and returns a new list containing all of the strings in the parameter list that begin with a digit ('0' through '9'). The list may contain empty strings, and if it does, these should simply be skipped. If the parameter list is empty the function should return an empty list. The original list should not be modified. An if-elif method should be use to find this solution. Don’t forget to include the docstring and comments.  Copy and paste or screen shot the code and the eight test cases shown below in your submission. >>> lst1 = ['first','2nd', 'third', '4th', 'fifth', '6th'] # assign a list to a variable name >>> numStrs(lst1) # use the list name in the function ['2nd', '4th', '6th'] >>> lst1 # display the list to show that it was not modified ['first', '2nd', 'third', '4th', 'fifth', '6th'] >>> lst2 = ['3.1415','pi','e','2.718','zero'] >>> numStrs(lst2) ['3.1415', '2.718'] >>> lst2 ['3.1415', 'pi', 'e', '2.718', 'zero'] >>> lst3 =['Earnest','Catherine','','75','Anthony'] >>> numStrs(lst3) ['75'] >>> lst3 ['Earnest', 'Catherine', '', '75', 'Anthony'] >>> lst = ['one','two','three'] >>> numStrs(lst) [] >>> lst = [] >>> numStrs(lst) []

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 3E
icon
Related questions
Question
100%

Python help, please show all steps and include comments

  1. Write a function numStrs() that takes a list of strings as a parameter and returns a new list containing all of the strings in the parameter list that begin with a digit ('0' through '9'). The list may contain empty strings, and if it does, these should simply be skipped. If the parameter list is empty the function should return an empty list. The original list should not be modified. An if-elif method should be use to find this solution. Don’t forget to include the docstring and comments.  Copy and paste or screen shot the code and the eight test cases shown below in your submission.

>>> lst1 = ['first','2nd', 'third', '4th', 'fifth', '6th'] # assign a list to a variable name

>>> numStrs(lst1) # use the list name in the function

['2nd', '4th', '6th']

>>> lst1 # display the list to show that it was not modified

['first', '2nd', 'third', '4th', 'fifth', '6th']

>>> lst2 = ['3.1415','pi','e','2.718','zero']

>>> numStrs(lst2)

['3.1415', '2.718']

>>> lst2

['3.1415', 'pi', 'e', '2.718', 'zero']

>>> lst3 =['Earnest','Catherine','','75','Anthony']

>>> numStrs(lst3)

['75']

>>> lst3

['Earnest', 'Catherine', '', '75', 'Anthony']

>>> lst = ['one','two','three']

>>> numStrs(lst)

[]

>>> lst = []

>>> numStrs(lst)

[]

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr