Python Basic data type

Source: Internet
Author: User

# Python basic data type


##### 1.Python Introduction


##### 2. Numeric type


##### 3. Sequence type



##### 1.Python Introduction

1.python is a programming language and a fully object-oriented programming language

2. If the language is categorized, then Python is a strongly typed, dynamic type of language

(Weak type: for example, int can be changed into Float,python, the value type is immutable;

(Dynamic type: The variable type is not known at compile time, and there is no type in Python)

3. The content of our basic Python course is to lay the groundwork for future courses, not to be able to write and python-like languages in the future, so the content will certainly be somewhat out of the question, if some students are interested in certain content, can discuss with the teacher after class



# # # 2. Numeric type


Numeric types are the types of numbers that we normally use to do calculations, and in Python there are several numeric types


"' Python

#整型

Int


#浮点型

Float


#布尔型

bool


#复数型 (in Python, lowercase j, denotes imaginary part, not with other letters)

Complex

```

Numeric types are primarily used to do operations, so there are also the following operators


"' Python

#数值运行常用运算符

+-*///(divisible, rounded down)% (take more) * * (Power)


#赋值运算符

=  +=  -=   *=  /=  ....

```


The first three of the basic numeric types are commonly used, and complex numbers are used much in mathematics, but they are generally not used.




# # # 3. Sequence type


Of the three sequence types in Python, the sequence type is simply that the elements inside the object are ordered.


"' Python

String str

Lists List

Tuple tuples

Variable sequence: List

Immutable sequence: Tuple,str

```

Sequence types are basic data types that you must master, and in Python you will often see these three types of data. The first step is to master the general operation of definitions and sequences.


**1. Creating a sequence * *


```

strings are created in quotation marks

The list is created with brackets []

Tuples use parentheses () or separate elements directly with commas

```


**2. Common operations for sequences * *


```

Index Value Tile Index: Forward index and reverse index

Conversion of type: str () list () tuple ()

Add + + =

Repeat * *=

Check member in

```




Summary of # #


The numeric types in Python are no different from our daily use, and are the same. For sequence types, remembering the definitions and common operations of each sequence type will naturally deepen the understanding after being used more later.


This article from "a dish can no longer dish of small rookie" blog, declined reprint!

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.