1.int () range size conversion.
@ creation, declaration of an integral type.
The process of creating an integral type and assigning a value to a variable is the same.
A = 123 equals the variable name on the left and the value to be assigned to the right, which is simple.
Features of the @ integral type
For integer type, it must be an integer when copying, simple is to say positive and negative integers.
@ Integer variable operator and method.
The integer data type variables currently supported by Python are: plus (+) minus (-) multiplication (*) in addition to (*) and power (* *)
>>>b = 10
>>>a = 3
>>> a+b
13
>>>b-a
>>>7
>>>b*a
30
>>>b/a
3
>>> b*3
1000
>>>
What needs to be specifically explained is that the result of the division of the shape is also integral type, so the part after the decimal point will be shed, only the integer type is output. and to reference the results of a calculation, you must assign a value before referencing it before you can reference it.
The conversion between an @ integer and a string
Python integers have a common denominator with strings, and are immutable data types, but they can be converted to each other:
If there is now a = ' 222 ' b = 1, then we can get 223 or ' 2221 ' by converting:
>>>a = ' 222 ' (A is a string)
>>>b = 1 (b is integral type)
>>>c = Int (a) +b
>>> Print C
223
>>> d =a +str (b)
>>>print D
2221
>>>
>>>
If the type is different, the system will error.
It should be stated that:
1.) because Python int and string are immutable types, this reference simply refers to the corresponding data corresponding to the variable, rather than referencing the variable itself.
2.) Because this is immutable data type, the result must be copied and then referenced.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2. How to use list lists.
The list is widely used in Python, he can contain different data objects and types, but also has an ordered set, the list can use slices, indexes, etc., Python's list is a variable data type, support to add, modify, delete and other operations.
@ How to author a new list.
The list can be understood as a sequence of arbitrary objects, as long as the required parameter values are placed in "[]", such as:
names = [' Ada ', ' Amy ', ' Ella ', ' Sandy ']
A list can contain different object types, and it also supports nesting:
A = [' Q ', 123,[' abc ', 4], (+)]
The list above contains strings, integers, tuples, and a list of nested lists.
@ Modify the values in the list
The list is ordered, and we can use the subscript to determine the position, through the following example I believe you will soon understand how to modify the value of a list:
>>>a =[1,9,9]
>>>a[0]=9
>>>a
[9,9,9]
In this example, 1 of the 0 position is changed to 9.
The delete operation for the @ list
There are three common ways to delete a list, and the methods used by Del,remove,pop are different, so we'll start by understanding how del is used:
When you delete an element from a list, we first need to know where the element is and then delete it.
>>> name =[1,2,3,4, ' 21EQWD ']
>>>del Name[1]
>>>name
[1,3,4, ' 21EQWD ']
This article is from the Cloud neutron blog, so be sure to keep this source http://liyongtao.blog.51cto.com/11018743/1868217
Python (ii)