Python Small white Road (basic knowledge One)

Source: Internet
Author: User
Tags arithmetic operators

First, the opening output: print ("Hello world!")

Second, Chinese free line: #coding =utf-8 or #--Coding:utf-8--

Three, Linux multi-line: #!/usr/bin/python

Four, not a few comments:
1. #单行注释
2. "Multi-line Comment"

Identifiers consist of letters, underscores, numbers, and numbers cannot begin

Vi. keywords that cannot be modified or used
Import keyword
Keyword.kwlist

VII. Naming conventions:
1, see the name of the idea
2, Hump name law

Viii. Formatting of strings:
1. "My name is%s, this year%d years old"% (name, age))
2, "My name {0}, this year {1} years old". Format (Name,age)

Nine, Input: input () receives the expression input, and assigns the result of the expression to the variable to the left of the equal sign
Name = input ("Please enter Name:")
age = Int (input ("Please enter Ages:"))

Ten, Operator:
1, arithmetic operators: + 、-、 *,/,//,%, *
2. Assignment Operator: =
3. Compound assignment operator: +
=,-=, =,/=,//=,%=, **=

Xi. Common data type conversions
int (x [, Base]), Long (x [, Base]), float (x), complex (real [, imag]), str (x), repr (x), eval (str), tuple (s), list (s), Chr (x), UN ICHR (x), Ord (x), Hex (x), Oct (x)

12, the Judgment statement introduction: IF
If certain conditions are met, it is not permissible to do something without being satisfied. Daily, such as railway station security.

13. Comparison, relational operators
1, comparison (that is, the relationship) operator: = =,! =, <>, >, <, >=, <=
2. Logical operator: and OR not

Python Small white Road (basic knowledge One)

Related Article

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.