Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

  1. 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?

  1. (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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

Explain the market segmentation.

Answered: 1 week ago

Question

Mention the bases on which consumer market can be segmented.

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago