Python (ii) Python basic data type

Source: Internet
Author: User

variables

A variable is an area in memory

The name of a variable: A number that consists of letters, numbers, underscores, and cannot begin with

The address variable in Python is the opposite of the C language, and a single piece of data contains multiple tags:

>>> a=1
>>> b=1
>>> ID (a)
34909288
>>> ID (b)
34909288

Integral type

Note: type () can view data types

>>> num1=123
>>> type (NUM1)
<type 'int' >

Long integer type

#强制定义为长整型: num3=999l

>>> num2=9999999999999999999
>>> type (num2)
<type 'long' >


>>> num3=999l
>>> type (NUM3)
<type ' Long ' >

Floating point Type

#1.2e10 represents a value of 1.2 for 10 times;
#12e9代表的数值为12的9次方;

>>> f1=12.0
>>> Type (F1)
<type ' float ' >
>>> F2=1.2e10
>>> type (F2)
<type 'float' >

Plural type

#python对复数提供内嵌支持, eg:3.14j, 8.32e-36j

>>> c=3.14j
>>> type (c)
<type 'complex' >

Operators and expressions

Arithmetic operators: +,-, *,**,/,%,//








Python (ii) Python basic data type

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.