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
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*
*- These operators will be covered at a later stage when the related concepts are dealt.


    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 −

    OperatorDescriptionExample
    + AdditionAdds values on either side of the operator.a + b = 30
    - SubtractionSubtracts right hand operand from left hand operand.a – b = -10
    * MultiplicationMultiplies values on either side of the operatora * b = 200
    / DivisionDivides left hand operand by right hand operandb / a = 2
    % ModulusDivides left hand operand by right hand operand and returns remainderb % a = 0
    ** ExponentPerforms exponential (power) calculation on operatorsa**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

    Comments

    1. This comment has been removed by the author.

      ReplyDelete
    2. There is some issue with the date setting. I will correct it after the class

      ReplyDelete
    3. Pls go through the description and the output very carefully

      ReplyDelete
    4. You 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

      ReplyDelete
    5. maam... will be there Zoom Class at evening ?

      ReplyDelete
    6. We will meet again at 10:45 am on the blog and at 11am, we will have the zoom class

      ReplyDelete
    7. All those who are present must mark attendance

      ReplyDelete
    8. This comment has been removed by the author.

      ReplyDelete
    9. Are you able to understand the arithmatic operators now? Can you understand why the output?

      ReplyDelete
    10. This comment has been removed by the author.

      ReplyDelete

    Post a Comment

    Popular posts from this blog

    HOLIDAY HW