Python- operators(recap)
Python Operator
Good Morning Boys.
Lets take a quick recap of the topic covered on the last working day.
I hope that during the zoom class, all your doubts are answered.
There are some of you who haven't joined the zoom class so far. Please join from today else you may not feel comfortable with the concepts of programming, as they are new to you.
Python Operators
Lets take a quick recap of the topic covered on the last working day.
I hope that during the zoom class, all your doubts are answered.
There are some of you who haven't joined the zoom class so far. Please join from today else you may not feel comfortable with the concepts of programming, as they are new to you.
Python Operators
Operators are used to perform operations on variables and values.
Python divides the operators in the following groups:
- Arithmetic operators
- Assignment operators
- Comparison operators
- Logical operators
- Identity operators*
- Membership operators*
- Bitwise operators*
Python Arithmetic Operators
Arithmetic operators are used with numeric values to perform common mathematical operations. Assume variable a holds 10 and variable b holds 20, then −
| Operator | Description | Example |
|---|---|---|
| + Addition | Adds values on either side of the operator. | a + b = 30 |
| - Subtraction | Subtracts right hand operand from left hand operand. | a – b = -10 |
| * Multiplication | Multiplies values on either side of the operator | a * b = 200 |
| / Division | Divides left hand operand by right hand operand | b / a = 2 |
| % Modulus | Divides left hand operand by right hand operand and returns remainder | b % a = 0 |
| ** Exponent | Performs exponential (power) calculation on operators | a**b =10 to the power 20 |
| // | Floor Division - The division of operands where the result is the quotient in which the digits after the decimal point are removed. But if one of the operands is negative, the result is floored, i.e., rounded away from zero (towards negative infinity) − |
Are we clear about the difference between
- Normal division and floor division
- Division using / or // and the modulus (%) operator
Let us focus on the following example
( Note the output.We had covered these examples in the last class also. If you don't understand, share your doubts in the comment section.)
Example #1: Arithmetic operators in Python
x = 15
y = 4
# Output: x + y = 19
print('x + y =',x+y)
# Output: x - y = 11
print('x - y =',x-y)
# Output: x * y = 60
print('x * y =',x*y)
# Output: x / y = 3.75
print('x / y =',x/y)
# Output: x // y = 3
print('x // y =',x//y)
# Output: x ** y = 50625
print('x ** y =',x**y)
When you run the program, the output will be:
x + y = 19 x - y = 11 x * y = 60 x / y = 3.75 x // y = 3 x ** y = 50625
I shall wait so that you can share your doubts.
Once I receive 👍 from all, I shall proceed.
________________________________________________________
Please note
That we have a double period today during the 5th and the 6th period. At that time, I shall first cover another set of operators first and then switch to the zoom call from 11am - 11:40am. The invite for the same is as follows:
Geeta Sehgal is inviting you to a scheduled Zoom meeting.
Topic: Geeta Sehgal's Zoom Meeting
Time: Apr 1, 2020 11:00 AM Mumbai, Kolkata, New Delhi
Join Zoom Meeting
https://us04web.zoom.us/j/697204189?pwd=UERDWmdjVjVjWTU0dzlPUUJkbDNUUT09
Meeting ID: 697 204 189
Password: 076230
This comment has been removed by the author.
ReplyDeletegood morning maam
ReplyDeleteGood morning ma'am
ReplyDeleteGood morning boys
ReplyDeleteRnoit are you there?
ReplyDeleteRonit???
DeleteThere is some issue with the date setting. I will correct it after the class
ReplyDeleteGood morning ma'am
ReplyDeleteTejas
Pls go through the description and the output very carefully
ReplyDeleteYou must b e able to understand the output, if not, pls share your doubts. We have to start important concept of "Decision aking" for which all this is crucial
ReplyDeletemaam... will be there Zoom Class at evening ?
ReplyDeleteMa'am I am in.
ReplyDeleteGood Morning mam
ReplyDeleteGood morning ma'am
ReplyDeleteGood morning mam
ReplyDeleteBrian
We will meet again at 10:45 am on the blog and at 11am, we will have the zoom class
ReplyDeletePushkar are u there?
ReplyDeleteAll those who are present must mark attendance
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteAaron you are very late
DeleteAre you able to understand the arithmatic operators now? Can you understand why the output?
ReplyDeleteThis comment has been removed by the author.
ReplyDelete����👍🏻
ReplyDeletepls send a 👍 if understood.
ReplyDeleteGOOD MORNING MA'AM
ReplyDelete-ARTHAM
Good morning ma'am
ReplyDeleteRahul x-a
MAM I'M IN
ReplyDelete-ARTHAM