• Dictionaries
  • Python: Learn the Basics fast from Python Programming Experts




    Download 337.24 Kb.
    Pdf ko'rish
    bet9/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
    Numbers
    This data type keeps numerical values. Number data objects are generated when you set a
    value to them. Like this:
    Var1 = 2
    Var2 = 20
    You also have the option to remove the connection to a number object by utilizing the del
    command.
    del typ1[,typ2[,typ3[….,typN]]]]
    You can remove multiple objects (or just one single object) by employing the del
    statement.
    del typ
    del typ_x, typ_y
    Currently, the Python language supports four types of numerical objects:


    Complex numbers
    Floating point real values
    Signed integers
    Long integers
    Strings
    Python strings are defined as an adjacent group of characters displayed in the quotation
    marks. This programming language lets you use pairs of double or single quotes. You can
    obtain the subgroups of strings by using a slice operator ([ : ] and [ ]).
    The “+” symbol is the operator for combining strings, while the “*” sign is used for
    repetition.
    Lists
    Python lists are known to be the most flexible data type in this programming language. A
    list is a group of characters that contains objects enclosed within brackets and are
    separated by commas. In some way, Python lists are similar to “arrays” in the C language.
    The values inside a list can be taken by using a slice operator. Similar to Python strings,
    the “+” symbol is used for mixing (concatenation) purposes while for repetition, the
    asterisk “*” is employed.
    Because of their importance in the Python language, the next chapter will further discuss
    their characteristics.
    Dictionaries
    A dictionary in the Python language works like the related hashes or arrays used in Perl.


    The key of a dictionary can be any type of Python variables, but strings and numbers are
    most commonly used.
    These dictionaries are enclosed within curly brackets. Values, on the other hand, can be
    assigned and obtained by using the square brackets.
    Tuples
    This is a data type similar to a Python list. It consists of a group of values disjointed by
    commas. However, unlike Python lists, these tuples are expressed inside parentheses. This
    data type is considered as a read-only list. It cannot be modified or updated.

    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