Question: python Function Name: stringMultiply Parameters: sentence (str), num ( int) Returns: product (int) Description: You're texting your friend when you notice that they replace many

python

python Function Name: stringMultiply Parameters: sentence (str), num ( int) Returns: product

Function Name: stringMultiply Parameters: sentence (str), num ( int) Returns: product (int) Description: You're texting your friend when you notice that they replace many letters with numbers. Out of curiosity, you want to find the product of the numbers. Write a function that takes in a string sentence and an int num, and find the product of only the first num numbers in the sentence. If num is o, return O. If num > O but there aren't any numbers in the string, return 1. If num is greater than the amount of numbers in the sentence, return the product of all the numbers. (Hint: the isdigit() method may be helpful.) >>> sentence = "h3110 n1c3 2 m33t u" >>> num = 6 >>> print(stringMultiply(sentence, num)) 18 >>> sentence = "4nthony 4nd arvin were h3r3" >>> num = 10 >>> print(stringMultiply(sentence, num)) 144

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!