Handbook of python3.5 cultivation 1

Source: Internet
Author: User
Tags mathematical constants

Start the Python tour


Print (' Hello,qorld ') print is a function that needs to surround the printed content with "or" but not mix


*syntaxerror:invalid character in identifier syntax error, error while scanning string


Awareness Program

High-level languages translate into machine code there are two ways to interpret and compile

Interpreted language is the side-reading source program side execution. The high-level language is the source code, the interpreter reads a piece of the source code every time, executes it, reads and executes it, repeats it, and ends it.

A compiled language is a complete compilation of the source code into the target code before it can be executed, and subsequent execution does not need to be compiled.

*semantic Errprs Semantic Error


Data type (6 standard data types in Python3)

Number (numeric)

String (String)

List (lists)

Tuple (tuple)

Sets (collection)

Dictionary (dictionary)


numeric types (three numeric types are supported in Python3)

Shaping (int): Usually called shaping or integer, is a positive number, negative number, without dot decimal (note the two operators ①//: for the floor except forever as an integer, even if there is no endless and rounding a reason ②%: Take the remainder of the operation, you can get two integers division of the residue).

Float (float): consists of integers and fractional parts, or it can be represented by scientific notation.

Complex number (complex): consists of the real and imaginary parts.


Data type conversions

To convert a data type, you only need to use the data type as a function name

There are 4 functions that can be used when converting data types

int (x) converts x to an integer.

Float (x) converts x to a floating-point number.

Comples (x) converts x to a complex number, the real part is x, and the imaginary part is divided into 0.

The Comples (x, y) converts the X. and y into a complex number, the real part is x, and the imaginary part is Y. Both x and Y are numeric expressions.

function nesting

For example: float (int (x))


Constant

is not to become a quantity, for example, the usual mathematical constants π is a constant. In Python, constants are typically represented in all uppercase variable names.

Two more common constants in Python

PI: The mathematical constant Pi (pi is generally expressed in π).

E: Mathematical E, and natural constants.


This article is from the "Duyuheng" blog, make sure to keep this source http://duyuheng.blog.51cto.com/12879147/1957008

Handbook of python3.5 cultivation 1

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.