RESOURCES:

Class slides: https://docs.google.com/presentation/d/13o7_ZULP7vmTw1feA3cAUIhqHlLmGaKn7nPJ_pAra_0/edit?usp=sharing

Example code: https://replit.com/@ShravyaS/IntrotoPython-4

(Notes included in example code.)

HOMEWORK:

Take in input of the radius r of a circle and the side length x of a square. Compare the areas of the two and say which is larger. If the area of the circle is greater, print out "circle", if the area of the square is greater, print out "square", and if they are equal, print out "equal."

Write your answer as a comment, and we’ll post the solution by next class. See you then!

Note: VIP students, please contact us (Eric and me) about office hours!

radius = int(input("Radius: ")) side = int(input("Side: ")) circleArea = 3.14*(radius**2) squareArea = side*side if squareArea > circleArea: print('Square area is greater') elif squareArea == circleArea: print('Both the circle and the square\'s area are equal') elif squareArea < circleArea: print('Circle area is greater')

print('Please input the radius of the circle'); f_radius = float(input()); print('Please input the side length of the square'); f_length = float(input()); print('The radius of the circle is', f_radius); print('The length of the square is', f_length); area_circle = (f_radius**2)*3.14; print("The area of the circle is", area_circle); area_square = f_length**2 print("The area of the square is", area_square); if area_circle > area_square : print('Circle'); elif area_circle == area_square : print('Equal'); else : print('Square');