(Solved) : Consider Following Function Def Rate N Total 0 1 N J 0 J N Total J Total J J 1 2 Return To Q36203656 . . .
Consider the following function:
def rate(n): total = 0 i = 1 while i < n: j = 0 while j < n: total = i * j + total j = j + 1 i = i * 2 return total
Modify the function so it will print out the total number ofstatements that are executed inside the rate function shown. Do notcount any additional statements that you add to the code when youmodify it. You should count the lines containing loop conditions asbeing executed each time the condition is checked. Note that a loopcondition is checked 1 time more than the loop body is executed.Your output should be in the format:
Number of statements: <count>
where <count> is an integer value.
For example:
TestResultrate(2)Number of statements: 14
Expert Answer
Answer to Consider Following Function Def Rate N Total 0 1 N J 0 J N Total J Total J J 1 2 Return To Q36203656 . . .
OR