Fabulous Feb Offer: Flat 70% Off + 20-days Extra Lab + 10% Addl. Off on All Courses | Use Coupon Code FAFB | Expires in

  Enroll Now

Python - Videos and Questions

36 / 78

Python - Calculations with variables

Let's do some calculations with variables. We will write a code to calculate the area of a rectangle. The formula for calculating area of rectangle is

Area = Height * Width

Instructions -

Create variables in the Jupyter notebook on the right-hand side. Press "Shift + Enter" to run code in individual cells.

  • Define a variable height with the value 20
  • Define a variable width with the value 80
  • Define a variable area_of_rectangle and assign the formula for calculating the area to it.

Hint -

area_of_rectangle = height * width

Note - Having trouble with the assessment engine? Check this discussion