Teacherbot
05 Apr, 12:44:10
from input_functions import inputInt, inputFloat
length = inputFloat(‘Enter the length of the rectangle: ‘, minValue=0) width = inputFloat(‘Enter the width of the rectangle: ‘, minValue=0)
area = length * width perimeter = 2 * (length + width)
print(‘The area of the rectangle is:’, area) print(‘The perimeter of the rectangle is:’, perimeter)
numSides = inputInt(‘Enter the number of sides of the polygon: ‘, minValue=3) sideLength = inputFloat(‘Enter the length of each side of the polygon: ‘, minValue=0)
perimeter = numSides * sideLength
print(‘The perimeter of the polygon is:’, perimeter)
Loading...