"Acquaintance constant awareness of Python type function"

"Acquaintance constant awareness of Python type function"

1.2 Constant awareness

1, constant: we use is the value or content on its literal meaning.

2, number (Number)

 (1) represents an integer of: 97.

(2) floating point number: 5.29 or 78.2E-4 (E denotes a power of 10, 78.2 * 10-4).

(3) Boolean: True, False.

3, String (String): sequence of characters. Statement string

(1) single quotes: 'Iamastring' (String)

(2) double quotes: "Iamastring" (String)

(3) Three quotes: '' 'Iamastring' '' (multi-line comment, not a string) Note: single and double quotation marks, three marks must be used in pairs.

Thinking: How to declare I'mastring string.

type functions:

With type () function to understand the basic data types

1, type () function: the constant data types can be listed.

2, lists the data type numbers, with a string type ()

 

Demo Op:

 

 

Note that the above mentioned triple quotes is a comment rather than a string is not so with the type of

But using three single and double quotation marks are three possible

To focus back to back! :
Python has six standard data types:

1, Number (number)

2, String (String)

3, List (list)

4, Tuple (tuple)

5, Set (collection)

6, Dictionary (dictionary)

Finally, under the terms of variables and assignment Part I did not go into detail how

Variables and their assignments: Variable: a place to temporarily store data, variables can store various types of data, each variable must be assigned before use, the variable after variable assignment will be created. With "=" equal sign to be assigned to variables. The left side of the equal sign is the variable name, the right is the value stored in the variable.

2, variable assignments

integer variable counter = 99 #

miles = 9.9 # float variable

name = "runoob" # string

 

Guess you like

Origin www.cnblogs.com/judgecx/p/11700777.html