Define a new function ringRadiusdiameter numberOfRings ringN

Define a new function ringRadius(diameter, numberOfRings, ringNumber) to determine the radius of each ring, which will be based on the radius of the outer ring and what ring number it is. (Assuming that the rings are numbered 1…n, with 1 being the innermost ring, and n being the outermost ring.)

For example, if there are 5 rings and the outermost ring is 15 feet in diameter. The rings will have these radii:

This is the radius of the outermost circle, divided by the number of rings, times the ring number.

Ring Number (n) Radius
1 1.5
2 3
3 4.5
4 6
5 7.5

Solution

def ringRadius(diameter, numberOfRings, ringNumber):
   outerRadius = diameter / 2.0
   return (outerRadius / numberOfRings) * ringNumber

Define a new function ringRadius(diameter, numberOfRings, ringNumber) to determine the radius of each ring, which will be based on the radius of the outer ring

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site