Question
Code needed in python! A. Write a function FactRecursion that takes as a parameter a positive integer and returns its factorial using the recursive method.
Code needed in python!
- A. Write a function FactRecursion that takes as a parameter a positive integer and returns its factorial using the recursive method.
B. Write a function FactIterate that takes as a parameter a positive integer and returns its factorial using the iterative method.
C. Write a program that prompts the user to enter a positive integer (and verify it with a loop)
And then calculates its factorial twice, one using FactRecursion, and once using FactIterate. Which function is faster? What happens when we enter a large number?
- (This program uses iteration not recursion)
A. Write a function area that takes as a parameter the radius of a circle and returns the area of the circle. Write another function circumference that takes as a parameter the radius of a circle and returns the circumference of the circle. Use the formulas: Area of circle = x radius2 Circumference = 2 x x radius
B. Write a complete program that produces a table showing the area and circumference of circle for a range of radius values from 1 to 10 with a step of 1. Use the area and circumference functions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started