create a program to calculate and print the area of a rectangle if the users enters 1 and print the area of a square if the users enters 2
Answers
Answer:
Hey this is in python...
print('Calculate area of rectangle(1)')
print('Calculate area of square(2)')
choice = input("Your choice: ")
if choice == '1':
l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
print("Area of rectangle = ", l*b)
else:
s = float(input("Enter side: "))
print("Area of square = ", s*s)
# HOPE THIS HELPS!!
Answer:
import turtle
bob=turtle.Turtle #capitalization is very important
def _1_(length):
For i in range 4:
bob. fd length
bob. rt 90
def_2_(length, breadth) :
bob. Fd breadth
bob. rt 90
bob. fd length
bob. Rt 90
bob. Fd breadth
bob. rt 90
bob. Fd length
---------—----------------------------------------------------------
I have shown 2 ways. One draws square by using for loop. Other draws rectangle without using for loop. HOPE THIS HELPED. IF IT DID PLEASE MARK BRAINLIEST AND THANK.