Skip to content

Latest commit

 

History

History
 
 

The 2D Shape Area Calculator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

The 2D Shape Area Calculator 🧮

Aim

To Calculate the Area of 2D shapes

Purpose

The 2D shape Area Calculator is basic python script enables us to easily calculate Areas of 2D shapes.

Short description

  • This code is used find area of respective 2D shape by giving specified inputs. (Eg: If our 2D Shape is circle.To find Area of cirlce required input will be it's radius)
  • Libraries Imported: math

Workflow

  • Choose one option from the following 2D shape for which you need to find area
    • Circle
    • Triangle
    • Square
    • Rectangle
    • Parallelogram
    • Trapezium
    • Ellipse
  • Enter required inputs properly as follows:
    • If circle is opted then, required input is radius
    • If Triangle is opted then, required inputs are base height or sides
    • If Square is opted then, required input is side
    • If Rectangle is opted then, required inputs are length and breadth
    • If Parallelogram is opted then, required inputs are length and breadth
    • If Trapezium is opted then, required are bases and height
    • If Ellipse is opted then, required inputs are axis
  • Based on the shape opted by the user, it executes that particular block of code and takes input from user and gives Area as output.

Compilation Steps

  • Download " 2D_shapes_area_calculator.py " file.
  • Run "2D_shapes_area_calculator.py" file.
  • Find the area of any 2D shape by entering required inputs properly.
  • This program is made of simple "if - elif - else" syntax.
  • Start of the program every 2D shape is assigned a particular option. i.e., print("Please choose one of the following option to find Areas of 2D shape: \n1.Circle \n2.Triangle \n3.Square \n4.Rectangle \n5.Parallelogram \n6.Trapezium \n7.Ellipse")
  • The if statement checks for condition and if this condition evaluates to True,then the statements inside the if block will be executed.
  • If if condition evaluates to False, then flow of program control goes to elif statement and if this condition evaluates to True,then the statements inside the elif block will be executed.
  • The flow of control goes to elsecondition when the elif condition evaluates to False.
  • For more information on import statements, refer to "requirements.txt".

Output

  • Area of Circle

Circle
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfCircle.png

  • Area of Triangle

M1Triangle
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfTriangle1.png

M2Triangle
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfTriangle1.png

  • Area of Square

square
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfSquare.png

  • Area of Rectangle

Rectangle
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfRectangle.png

  • Area of Parallelogram

Parallelogram
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfParallelogram.png

  • Area of Trapezium

Trapezium
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfTrapezium.png

  • Area of Ellipse

Ellipse
Path link: https://github.com/DurgaSai-16/Awesome_Python_Scripts/blob/main/BasicPythonScripts/The%202D%20Shape%20Area%20Calculator/Images/AreaOfEllipse.png

Author:

NALLANI DURGA SAI