Day1-Python basics, day1-python Basics

Source: Internet
Author: User

Day1-Python basics, day1-python Basics

Python is the product of Daniel's "boring" Christmas holiday. -- For details, refer to Baidu encyclopedia.

  • Python official introduction:

    Python is a simple, easy-to-learn and powerful programming language. It has an efficient High-Level Data Structure and implements Object-Oriented Programming simply and effectively. Python's concise syntax and support for Dynamic Input, coupled with the essence of explanatory language, make it an ideal scripting language in many fields on most platforms, it is especially suitable for fast application development.

  • Basic concepts of Python
    • Quantity

Integer

Long Integer 000000000,900000000000000

Floating Point Number 3.1415926

Plural 2 ** 10

  • String

You can use single quotation marks (''), double quotation marks (" "), and three quotation marks (''' or") to indicate a string.

Use range '<"""(''')

"", Can also be used as comments for multiple rows

"Dogs"

  • List)

["Apple", "pear", "orange"]

  • Tuple)

("Apple", "pear", "orange ")

  • Dictionary (dict)

{"A1": "Apple", "A2": "Pear", "A3": "Orange "}

  • Note

    #

    """

  • Slice
    • List slice:

>>> List_F = ["Apple", "Pear", "Orange"]
>>> List_F
['Apple', 'pear ', 'Orange']
>>> List_F [0]
'Apple'
>>> List_F [1]
'Pear'
>>> List_F [-1]
'Orange'
>>> List_F [:-1]
['Apple', 'pear ']
>>> List_F [0:-1]
['Apple', 'pear ']
>>> List_F [0:]
['Apple', 'pear ', 'Orange']

  • Tuples:

    > Tuple_F = ("Apple", "Pear", "Orange ")
    >>> Tuple_F [0]
    'Apple'
    >>> Tuple_F [1]
    'Pear'
    >>> Tuple_F [-1]
    'Orange'

    >>> Tuple_F [:-1]
    ('Apple', 'pear ')
    >>> Tuple_F [0:-1]
    ('Apple', 'pear ')
    >>> Tuple_F [0:]
    ('Apple', 'pear ', 'Orange ')

  • String slicing:

    >>> Str_1 = "apple"

    >>> Str_1 [0]

    'A'

    >>> Str_1 [1]

    'P'

    >>> Str_1 [2]

    'P'

    >>> Str_1 [-1]

    'E'

    >>> Str_1 [0:-1]

    'Appl'

    >>> Str_1 [0:]

    'Apple'

    >>> Str_1 [1:-1]

    'Ppl'

  • Slice

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.