Question: Practice problem 1 Write the function countPunct_index that takes a string s and returns the number of punctuation characters in s. In this version, use

 Practice problem 1 Write the function countPunct_index that takes a string
s and returns the number of punctuation characters in s. In this

Practice problem 1 Write the function countPunct_index that takes a string s and returns the number of punctuation characters in s. In this version, use a for loop and iteration by index of element. Call the function on my test data. Sample input s= "Let's code!" Expected output 2 Sample input s= 'Does the equation x2+1=0 have real roots?' Expected output 5 Write the function linearSearch that takes a list L of elements of the same type, and a value x of the same type, and returns the (nonnegative) index of this value in the list, or 1 if the value does not exist in the list. That is, you are searching for the value in the list. Use the obvious brute-force strategy of looking for the element in the list by walking through the list from the beginning to the end, looking for the element, and returning the present index as soon as you find it. If the value occurs more than once in the list, return the index of the first occurrence. Sample input L=[30,25,64,30,64,20],x=64 Expected output 2 Sample input L = ['jardin', 'garten', 'hortus', 'garden', 'have', 'puutarha', 'beerta'], x= 'garden' Expected output 3 Sample input L=[30,40,50],x=60 Expected output 1

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!