Python Learning Notes

Source: Internet
Author: User

2014.08. 22

For information about the latest releases and related tools,the python.org website is a cornucopia.

Windows Installation:python x.x or ActivePython

Python is an interpretative, object-oriented, high-level programming language with dynamic semantics.

Liunx, enter python to start the interactive python interpreter,ctrl-d exit the interactive interpreter;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/47/20/wKioL1P3AGmBxNakAAS8vwBjCTY975.jpg "style=" float: none; "title=" 1.png "alt=" Wkiol1p3agmbxnakaas8vwbjcty975.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/47/1F/wKiom1P2_1HxpOKXAAaf4OoRMC4074.jpg "style=" float: none; "title=" 2.png "alt=" Wkiom1p2_1hxpokxaaaf4oormc4074.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/47/20/wKioL1P3AGmCMZ7JAAQL4kT229w116.jpg "style=" float: none; "title=" 3.png "alt=" Wkiol1p3agmcmz7jaaql4kt229w116.jpg "/>

1.The Python line is a row , not like other computer languages, each line to the end of a good.

2. if one of the two numbers participating in the division is a floating-point number, the result is also a float:

>>>1/2.0

0.5

If you want python to perform only normal division, you can precede the program with

>>>from __future__ Import Division

>>>1/2

0.5

Alternatively, you can use the command switch -qnew.

Python also provides another operator to achieve the division of the integer ------ double Slash

>>>1//2

0

3. The remainder of the x%y operator ------- The result of x divided by y

4. Power operator

>>>2**3

8

The power operator has a higher precedence than the inverse (unary minus operator), so -3**2 is equivalent to-(3**2)

5. A variable is a name that represents or refers to a value. Variable names can contain letters, numbers, and underscores (_). A variable cannot begin with a number.

6. in python3.0 ,print is a function that requires writing printinstead of print 42.

general definition of statement attributes: they change things. For example, the assignment statement changes the variable, andthe print statement changes the contents of the screen display.

7. Input function

>>>x=input ("x:")

X:32

>>>y=input ("Y:")

Y:32

>>>print X*y

1024

The statement following the Python prompt (>>>) can be counted as part of a complete program.


Python Learning Notes

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.