Question: 3 1 Recursion a) Define recursion and explain how you would prevent an infinite loop from occurring b) Wnte a program that calculates the sum

3 1 Recursion a) Define recursion and explain how you would prevent an infinite loop from occurring b) Wnte a program that calculates the sum of numbers 5 to 11 using recursion(4) c Wnte a program that calculates the factonal of 4 using recursion 3 2 Classes a) A class consists of a number of attnbutes that include variables and methods Fill in the blanks The vanables are called and the methods are called statement does and what Consider the following statement and explain what the pass ts purpose is b) #paasex ?? class rect lobject): pasa rect.l-8 prant (rect 1) c) What is the difference between a class vanable and an instance vanable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
