Write a for loop to verify that your function is correctly returning the expected output for the radius values between 0 and 11. (Remember the issue you might run into when comparing floating point values? What do you need to do to correctly handle it in the pytest framework?

Respuesta :

Answer:

(1)function areaOfCircle(radius)

import math

def areaOfCircle(radius):

return math.pi*radius*radius

(2)calling function areaOfCircle() with radius value 5 and 8

areaOfCircle(5)

areaOfCircle(8)

(3)

def test_areaOf_Circle_1():

import math

for radius in range(0,11):

assert areaOfCircle(radius) == math.pi*radius*radius

ACCESS MORE