Only Few Seats Left for Advanced Certification Courses on Data Science, ML & AI by E&ICT Academy IIT Roorkee

  Apply Now

Advanced Operations in Python

So far we have seen basic operations in Python such as addition, subtraction, multiplication, and division.

Let's see some of the advanced operations in Python

  • Exponentiation: **. This operator raises the number to its left to the power of the number to its right. For example, 8 ** 2 gives 64.

  • Modulo: %. This operator returns the remainder of the division of the number to the left by the number on its right. For example, 16 % 7 equals 2 and 5 % 2 equals 1

Let's do some hands-on on exponentiation and modulo. Follow the instructions given below

INSTRUCTIONS

Let's calculate the area of a square having one side as 4 cm. Use the below formula for calculating the area of a square

Area of a square = (side) ^ 2
  • Here, the side is 4
  • Write an expression for calculating area using ** operator
  • Plug in the value of side in the above formula
  • Fill in the value of computed area below

Area of the square is


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...