• Arithmetic Operators
  • Logical Operators
  • Python: Learn the Basics fast from Python Programming Experts




    Download 337.24 Kb.
    Pdf ko'rish
    bet6/10
    Sana12.05.2023
    Hajmi337.24 Kb.
    #58921
    1   2   3   4   5   6   7   8   9   10
    Bog'liq
    Patterson C. - Python Learn the Basics FAST From Python Programming Experts
    10 nazorat, Axrorova K. F8, majburiy matematika 24, Prosentga oid masalalar
    Identity Operators
    These operators compare the locations of two elements. We will talk about two identity
    operators here:
    Operators
    Definitions
    Examples
    Is not
    Its value becomes false if the operands on either side of the basic
    operator is pointing to a single element.
    Y is not X, “is not” came from 1 if id
    (X) is not equal to id (Y)
    Is
    Its value becomes true if the operands on either side of the basic
    operator is pointing to a single element.
    X is Y, “is” came from 1 if id (X) is
    equal to id (Y)
    Arithmetic Operators
    For these operators, let’s assume that variable X has the value of 1 and variable Y has the


    value of 2. Then:
    Operators
    Definition
    Examples
    // or Floor Division
    It divides the operands where the resulting value is the quotient in which
    the numbers past the decimal point are deleted.
    10 // 2 equals 5 and 10.0 // 2.0 =
    5.0
    * or Exponents
    It performs a power (exponential) computation on the operators.
    X ** Y = 2 to the power of 1
    % or Modulus
    It divides the left operand by the value of the right operand and gives out
    the remainder.
    Y % X = 0
    + or Addition
    This operator simply adds the values of the operands.
    X + Y = 3
    - Or Subtraction
    This operator subtracts the value of the right operand from the left operand.
    X – Y = 1
    * or Multiplication
    This operator multiples the values of the operands.
    X * Y = 2
    / or Division
    It the divides the value of the left operand by the left operand.
    Y / X = 2
    Logical Operators
    These are the logical operators used in the Python programming language. We will assume
    that variable X is equal to 1 and variable Y is equal to 2.
    Operators
    Definition
    Examples
    Logical AND (and)
    The condition is only true if the two operands are true.
    (X and Y) is true.
    Logical OR (or)
    The condition is only true if one of the operands is not equal to zero.
    (X and Y) is true.
    Logical NOT (not)
    This operator is used to reverse an operand’s logical status.
    Not (X and Y) is false.

    Download 337.24 Kb.
    1   2   3   4   5   6   7   8   9   10




    Download 337.24 Kb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Python: Learn the Basics fast from Python Programming Experts

    Download 337.24 Kb.
    Pdf ko'rish