2020-10-19 21:08:55

This commit is contained in:
wizardforcel
2020-10-19 21:08:55 +08:00
parent 7f63048035
commit ab0caba1f0
140 changed files with 3982 additions and 3982 deletions

View File

@@ -4,7 +4,7 @@
In [1]:
```
```py
a = [1,2,3,4]
a
@@ -12,7 +12,7 @@ a
Out[1]:
```
```py
[1, 2, 3, 4]
```
@@ -20,7 +20,7 @@ Out[1]:
In [2]:
```
```py
a[0] = 100
a
@@ -28,7 +28,7 @@ a
Out[2]:
```
```py
[100, 2, 3, 4]
```
@@ -36,7 +36,7 @@ Out[2]:
In [3]:
```
```py
a.insert(3, 200)
a
@@ -44,13 +44,13 @@ a
Out[3]:
```
```py
[100, 2, 3, 200, 4]
```
In [4]:
```
```py
a.sort()
a
@@ -58,7 +58,7 @@ a
Out[4]:
```
```py
[2, 3, 4, 100, 200]
```
@@ -66,7 +66,7 @@ Out[4]:
In [5]:
```
```py
s = "hello world"
s
@@ -74,7 +74,7 @@ s
Out[5]:
```
```py
'hello world'
```
@@ -82,12 +82,12 @@ Out[5]:
In [6]:
```
```py
s[0] = 'z'
```
```
```py
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-83b06971f05e> in <module>()
@@ -100,13 +100,13 @@ TypeError: 'str' object does not support item assignment
In [7]:
```
```py
print s.replace('world', 'Mars')
print s
```
```
```py
hello Mars
hello world
@@ -116,14 +116,14 @@ hello world
In [8]:
```
```py
s = "hello world"
s = s.replace('world', 'Mars')
print s
```
```
```py
hello Mars
```
@@ -132,7 +132,7 @@ hello Mars
In [9]:
```
```py
s = bytearray('abcde')
s[1:3] = '12'
s
@@ -141,7 +141,7 @@ s
Out[9]:
```
```py
bytearray(b'a12de')
```
@@ -157,7 +157,7 @@ bytearray(b'a12de')
In [10]:
```
```py
a = [1, 2, 3, 4]
b = a
@@ -167,7 +167,7 @@ b = a
In [11]:
```
```py
b[0] = 100
a
@@ -175,7 +175,7 @@ a
Out[11]:
```
```py
[100, 2, 3, 4]
```