• Chapter 5: Python Programming – Variables and Types
  • Python: Learn the Basics fast from Python Programming Experts




    Download 337.24 Kb.
    Pdf ko'rish
    bet8/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
    Assignment Operators
    We will just assume that the variable X is equal to 1, variable Y is equal to 2 and variable
    Z is unknown.
    Operators
    Definition
    Examples
    //= or Floor Division
    This one performs a floor division on the operators and assigns a value of
    the left hand operand.
    (Z //= X) is equal to (Z = Z // X)
    **= or Exponent AND
    This one performs a power (exponential) computation on the operators and
    assigns the value of the left hand operand.
    (Z **= X) is equal to (Z = Z **
    X)
    %= or Modulus AND
    A modulus is taken from two operands and assigns the value of the left
    operand.
    (Z %= X) is equal to (Z = Z %=
    X)
    += or Addition AND
    The value of the right hand operand is added to the left hand operand and
    sets the sum as the value of the left hand operand.
    (Z += X) is equal to (Z = Z + X)
    -= or Subtraction AND
    The value of the right operand is deducted from the left operand and sets
    the difference as the left operand’s value.
    (Z -+ X) is equal to (Z = Z -X)
    *= or Multiplication AND
    The value of the left operand is multiplied with the value of the right
    operand and sets the product as the left operand’s value.
    (Z *= X) is equal to (Z = Z * X)
    /= or Division AND
    The value of the left hand operand is divided using the value of the right
    hand operand and assigns the result as the left operand’s new value.
    (Z /= X) is equal to (Z = Z / XZ
    /= X) is equal to (Z = Z / X)
    =
    The value of the right operand is assigned to the left operand.
    Z = X + Y assigns the value of X
    + Y into Z



    Chapter 5: Python Programming –
    Variables and Types
    The Python language is heavily object-focused, and is not “typed statically.” The
    programmer doesn’t have to specify variables before he can use them, or define their type.
    We can say that each variable in Python is a standalone object.
    This chapter will discuss some of these basic variable types.

    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