Python Program to Find Area of Rectangle

A Rectangle is a planar shape which have its opposite sides being equal like a closed shape having sides as 4, 4, 5, 5 with opposite sides being equal will be a Rectangle. Mathematically area of Rectangle can be found by just multiplying it’s sides. For example – If a rectangle have sides a, a, b, b then area of it will be a * b. Quite simple just multiplication.
Let’s Program this as Python Code for Finding Area of Rectangle.

# Finding Area of a Rectangle using Python

# Ask User for two sides of Rectangle
a = float(input("First Side of Rectangle => "))
b = float(input("Second Side of Rectangle => "))

# Multiply together two sides inputted by user
area_of_rectangle = a * b

# Printing out area of rectangle
print("Area of rectangle is =>", area_of_rectangle)

Output of Above Code

First Side of Rectangle => 4
Second Side of Rectangle => 5
Area of rectangle is => 20.0

Gagan

Hi, there I'm founder of ComputerScienceHub(Started this to bring useful Computer Science information just at one place). Personally I've been doing JavaScript, Python development since 2015(Been long) - Worked upon couple of Web Development Projects, Did some Data Science stuff using Python. Nowadays primarily I work as Freelance JavaScript Developer(Web Developer) and on side-by-side managing team of Computer Science specialists at ComputerScienceHub.io

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts