Python Basics Tutorial Learning Notes Chapter I basic knowledge _android

Source: Internet
Author: User

1. After each statement in Python, you can add a semicolon or do not add a semicolon; When you have multiple statements in a row, you must use semicolons to differentiate

2. View the Python version number, enter "Python-v" in the DOS window to view the version number, note that V is a capital letter, this command is a Windows command, not a python shell command

3, let the interpreter only perform ordinary division operations: from __feture__ Import Division

4, the operator that performs the divide operation://

5, the power operator: 2**4 equivalent to 2 of 4 times, -2**4 equivalent to 2 4 times after the negative, because the negative operator priority is lower than the * * operator, pow (base, exponential) function can also achieve the purpose of the * * operator, and should be better

6, in the lower version of Python, the larger number to add the L suffix

7. The difference between an expression and a statement: An expression--something; statement--doing sth.

8, direct input 2*2 will automatically output operation results, is the default behavior of the Interpreter

9. The Python shell will not call the Repr () function on the statement, only call the Repr () function on an expression

10, input ("Hint text:") The return value of the method is the user input content

11. You need to import the math module before using the Math function: Import Math

The functions to perform the math module after that are as follows:

Math.Round (): Find approximate value
Math.Abs (): To find absolute value
Math.floor (): Find the largest integer that is not greater than the parameter
Math.ceil (): The smallest integer that is not less than the parameter
Math.sqrt (): square root

If you do not want to enter math, you can perform: From the math import floor similar statements

12, Cmath function needs to import the Cmath module, with the math module is the same and function, but is the complex number of operations

13, Nan means: not a number

14. Execute Python Program: full name of Python py file

15, single and double quotes can represent strings, but need to match

Ways to connect strings:a> two strings connected automatically connect 2> using hyphens + connection strings (this is the same as Java)

16, "" "" "" "" and "" string contents of the contents of the string can be multiple lines, or can contain single quotes, double quotes

17, the repr () function and the STR () function are all to convert other types to string types

18, Python a statement can use \ to wrap

19, the original string is the word normal before the string plus r to indicate that the end can not have a single \, but can have more than one, these \\\ will be output as is, without escaping

20, Python 3.0, are Unicode characters, each character occupies 16 bits, 3.0 are previously ASCII characters, each character occupies 8 bits; The Unicode string prefix can use U

21. Transformation function: Float (), int (), Long ()

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.