Day-3,Python Programming: From Beginner to Pro in 30 Days

Python Programming Day 3
Python Programming Day 3

Day 3: Operators and Expressions


In programming, operators are symbols or keywords that are used to perform various operations on values or variables. In this article, we will cover some of the commonly used operators in programming, including arithmetic operators, comparison operators, logical operators, and assignment operators. We will also discuss expressions and how they are evaluated.

Table of Contents:

  1. Arithmetic operators
  2. Comparison operators
  3. Logical operators
  4. Assignment operators
  5. Expressions and their evaluation

Arithmetic Operators:

Arithmetic operators are used to perform mathematical operations on numerical values. The most common arithmetic operators are addition (+), subtraction (-), multiplication (*), division (/), and modulo (%). These operators follow the standard order of operations (PEMDAS), which means that expressions are evaluated in the following order: parentheses, exponents, multiplication and division (from left to right), and addition and subtraction (from left to right).


AVvXsEisyTJsu1TaJ xEAJFNoNS Puw7gfaVe eXgUkLf8jYssi5zKJjrjVb0KxggNFWw PZMvvWmIIHwWJP0ZjC kg437IRLVEHiT2jmwsIPde9W r1sENNTUEIDKTjir6 aqPOMkvxs8kIr6EW5rPYNHs1Nl74eAveTdDrxjokyzOJL8BcgIjVX8Xw4Tix=w640 h464

“Learn How to Control Program Flow in Python – Day 4” – Read more here:

Comparison Operators:

Comparison operators are used to compare two values or variables. The result of a comparison operator is a Boolean value (True or False). The most common comparison operators are greater than (>), less than (<), greater than or equal to (>=), less than or equal to (<=), equal to (==), and not equal to (!=).

See also  Unlocking the Potential of Artificial Intelligence: A Comprehensive Guide to AI Courses, PDFs, Applications, and Future


AVvXsEjMnK esbFHI Jmh gJkSUvXwgFHpZsjWLFg8E BkEo r7bwklGG1anUNKU85x9G Rzk3EGqMs4iqOjK ynnPPlr5oGwqjBQ2tQSQY5XBOwupYO15UY Y1MpzueCpEg6biJKa3jDJfz LOyUAAopfD0bq6nAA xajIjS whmbSUJR2FbU91zPqRLQd8=w640 h533

Logical Operators:

Logical operators are used to combine Boolean values and return a Boolean result. The most common logical operators are and, or, and not. The and operator returns True if both operands are True, the or operator returns True if at least one operand is True, and the not operator returns the opposite of the operand’s value.


AVvXsEhGS2oWVQh2PD7RJT3Fy6wcTaTRq x6n9FODaw7NgWJLPufc2ROjKtKDHbOmIsgyrJ5i8zi7UFg79kaG6vIaLtkccCGmjmZyOc7oPJtOFXzxSgFVhZQghOMmY tW uhoiFptgvF1VaSIeB6pN4NJQAVFqgrbwTGKoP6OzZQSelRM9q I9KdXPT AHJr=w640 h314

Assignment Operators:

Assignment operators are used to assign values to variables. The most common assignment operator is the equal sign (=), but there are also compound assignment operators that combine an arithmetic operator with an assignment operator, such as +=, -=, *=, /=, and %=.


AVvXsEiPuEeQdP AnnnwMplBhcSx iezUEr8o7pXLHWIBcElss64UBQuR6IdjK4YiI4w 4ZAIrRE19D2XxoF3ID7YabEcgREbx6z5Hm5SxhNeWIPI0b7idP2d28aL5bVGVDHhOIUxpBl9xBBqDdIPCWVgjMN7qF0Dhp8g4jvJURKrljUGuAdpMQZgQoWXQxx=w640 h226

Expressions and their Evaluation:
An expression is a combination of values, variables, and operators that are evaluated to produce a result. Expressions can be simple or complex and can include multiple operators and parentheses. When an expression is evaluated, the operators are applied to the values in a specific order based on the order of operations.


AVvXsEgSQrmf6XkBuaWBw q0cSyyEL 5Ug2rhbs dinAPKVa3IZtq3uRpNLhsRVmHYkHBdyftv33ia PWOEZyfTSNfROMg1LhbShf0H7lRT0UhyTqyOOJPgNBfNFVDNE9ONVBVCPYnkgKWUShXLgWNfvih7ZeYC M2QnJ9j cb07k9tpnjSZpltIezd8nXyf=w640 h154

Expressions can also include variables, functions, and constants. When evaluating an expression, the values of the variables are substituted, and the functions are called with their arguments. The constants remain unchanged.


AVvXsEj28kBz5ePWzeSsHTJsoAf2QzOp8RcEGMyv2YwH yE a infSqzzGfvB lnzBn887wy9E6LJrpX BYIyIXBi7DTeah6l5mtY UWqQyHA2FFYmrHNbDnWaLqEGmMIoiSJyWq3I7GvpBoPrf4 LTT Fd0LVTh8DL8oE45pacCVpUmayNBiHbIlWTfqSja=w640 h108

In Python, expressions are evaluated using the interpreter or a program. The interpreter reads the code line by line and evaluates each expression as it encounters it. A program runs the code from start to finish and evaluates each expression in the order that it appears.

See also  Artificial Intelligence Courses After 12th


In this article, we covered some of the most commonly used operators in programming, including arithmetic, comparison, logical, and assignment operators. We also discussed expressions and how they are evaluated in Python. By understanding these concepts, you will be able to write more complex programs and perform more advanced operations on your data.

Tags: Python, Operators, Expressions, Arithmetic Operators, Comparison Operators, Logical Operators, Assignment Operators, Expressions Evaluation.

“Learn How to Control Program Flow in Python – Day 4” – Read more here:


Leave a Reply