Python Quick Start Tutorial

Source: Internet
Author: User

python version

Python's current version is divided into 2.7 and 3.5, and the two versions of the code are currently incompatible, looking at the Python version number:

Python--version
Basic data TypesNumber Type

The use of integral and floating-point data is basically consistent with other programming languages:

x = 3Print(Type (x))Print(x)Print(x + 1)Print(x-1)Print(X * 2)Print(x * * 2) x+ = 1Print(x) x*=2Print(x) y= 2.5Print(Type (y))Print(Y,y + 1,y * 2,y * * 2) M= 5N= 3Print(5/3)#precise division, preserving the decimal partPrint(5//3)#take only the integer part of the division resultPrint(5% 3)#two integers to divide the remainder ofPrint(Divmod (M,n))#back (x//y, x%y)Print(Pow (m,n))#Power Calculationa=-3Print(ABS (a))#Absolute Value CalculationPrint(-a)#Take counterPrint(+a) C= 2-3j#pluralPrint(Type (c))Print(c.real)#Real DepartmentPrint(C.IMAG)#Imaginary Part

Results:

<class'int'>3426948<class'float' >2.5 3.5 5.0 6.251.666666666666666712(1, 2)12533-3<class' Complex '>2.0-3.0

Note that unlike other languages, there is no self-adding, self-subtraction operation in Python, that is, there is no following operation:

i++I--

Python Quick Start Tutorial

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.