Question: Step 2: Notice that the docstring is actually incomplete! The first test command (repeat ( 'yes' , 4) is followed by its expected result ('yesyesyesyes'

Step 2: Notice that the docstring is actually incomplete! The first test command (repeat ( 'yes' , 4) is followed by its expected result ('yesyesyesyes' ) but the next three test commands are missing their expected results. Please enter in the expected results for the final three test commands (Insert a line between each one). Step 3: Write the body of the function. To convince yourself that your function's body is correct, you may [optionally] begin by testing your function using the Python shell 1. Hit the green arrow button to execute the function's definition (to see if the code has any syntax errors to fix up) 2. In the Python shell, type each of the test commands listed in the docstring. Example: >>> repeat ( 'yes' , 4) To finish, though, you must write the tests of the function as call expressions below in the main script. Example: result = repeat ( 'yes' , 4) print (result) Exercise 5 (Adapted from Practical Programming, Chapter 4, Exercise 9) Continue adding code to your existing file. Follow the same steps from the previous exercise to complete and test the next function. def total_length(s1: str, s2: str) -> int: Return the sum of the lengths of s1 and s2. > > > total_length( 'yes', 'no' ) 5 > > > total_length( 'yes' , '') > >> total_length( 'YES! ! ! ! ', 'Noooooo ' )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
