Operations in Python

In Python, operations refer to actions performed on data using operators—special symbols or keywords that manipulate values,
known as operands. These operations are fundamental to programming, enabling tasks like calculations, comparisons, and data manipulation.

Types of Operations in Python

  1. Addition (+) ex: 5 + 6
  2. Subtraction (-) ex: 5 - 6
  3. Multiplication (*) ex: 5 * 6
  4. Division (/) ex: 5 / 6
  5. Modulus (%) ex: 5 % 6
  6. Exponentiation ex: 5 ** 6

The operators above are called Arthemetic Operators

Arthemetic Operators are used to perform basic mental math

Printing Operations

What if we want our answer to our operation to be displayed?

We use the built-in print() function

For Example:

print(3 + 5)

The output of the code above would be 8 since 3 + 5 is 8!

If you want a better understanding of Operations in Python Click the link below to watch a video about Operations in Python!

https://youtu.be/f5pl5N2m-kg?si=dntd5kngb1ZwAxJG Next

Challenge (optional)

Make a program that has 2 variables which are age and birthyear give them a value of your age and your birthyear and then finally multiply the 2 variables!

r


⏳ Loading...