Basics of Python programming

Source: Internet
Author: User

Python Programming basic data types
    • None value

    • Integral type

    • Floating point Type

    • Boolean type
      True,false

    • String

    • Tuple tuples
      (), ordered, not variable
      Cases:
      t = (1,)
      t = (1, ' Hello ', 1.0,true)

    • Lists List
      [], ordered, variable
      Cases:
      L = [1, ' Hello ', 1.0,true]

    • Dictionary Dict
      {}, key-value pairs, unordered
      Cases:
      D = {: ' A ', 48:0, ' a ': $, ' Hello ': ' World '}

Operator Math operator
    • +

    • -

    • *

    • /except

    • Divisible

    • % modulus

    • * * Index

Comparison operators
    • ==

    • !=

    • >

    • <

    • >=

    • <=

Boolean operator
    • And,or

    • Not

Variable scope
    • Local variables
      Global statement: Modifying a globally variable within a function

    • Global variables

Comment Line Comment

# single Comment

Multi-line comments

"' Multiple lines
Note ""

Special Notes

#!python3
Must be the first line of the file and must be #! Beginning

Control flow Condition Branch
    • If statement

    • Else statement

    • elif statements

Cycle
    • While statement

    • For Loop and range () functions

    • Break statement

    • Continue statements

Exception handling

Try
Except XXX:
Else

function function definition
    • def statement

    • Return statement

Common functions
    • Print ()

    • Input ()


This article is from the "Learning" blog, so be sure to keep this source http://learnwithme.blog.51cto.com/7148047/1895594

Basics of Python programming

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.