To become the most awesome test and testing development. Learn python from today and write blogs. -- Python BASICS (1), python. -- python

Source: Internet
Author: User

To become the most awesome test and testing development. Learn python from today and write blogs. -- Python BASICS (1), python. -- python

Python 3.4.3 (v3.4.3: 9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license ()" for more information.

Long Integer:

Python can handle very large numbers.

>>> 100000000000000000000000 100000000000000000000000L >>> 100000000000000000000000L 100000000000000000000000L

The normal integer is between 2 147 483 647 and-2 147 483 647. If the value is exceeded, it can be expressed as a long integer (L ), we can also convert the integer into an integer (Add "L" at the end of the input ")

Variable naming rules:

Rule for defining variables: a variable can contain letters, numbers, and underscores, but cannot start with a number. It generally does not start with an underscore.

Function:

Power operator (**) to calculate the multiplication. In fact, you can use a function to replace the operator. This function is pow:

 

>>> 3 ** 3
27
>>> Pow (3, 4)
81
>>>

We usually call functions provided by pow and other systems as built-in functions. This function also calculates the absolute value of abs (), and round () rounds the floating point number to the nearest integer.

>>> Abs (-12.23)
12.23

>>> Round (17.4501)
17
>>> Round (17.54)
18

Module

Import to import modules

Floor () function, rounded down.

>>> Math. floor (12.78)
12
>>> Int (12.78)
12
>>>

The sqrt () function calculates the square root of a number.

>>> From math import sqrt # This import method is not recommended
>>> Sqrt (9)
3.0
>>>

 

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.