type( ), mutable and Immutable, copy( ) 列表更多應用
參考資訊:
網站: https://automatetheboringstuff.com/chapter4/
說明:
type( ), mutable and Immutable, copy( ) 列表更多應用
- type( ):
- 顯示( )內的類型
- 常見的類型:
列表: List 元組: Tuple 字串: Str 整數: Int 浮點數: Float
 
 - 常見的類型:
 
 - 顯示( )內的類型
 - list( ) and tuple( ):
- 將( )內的類型轉為list or tuple,也可以轉為str int float
 
 - Mutable and Immutable:
- 可變和不可變的數據類型
 - 注意: 字串不能被更改內容,只能被覆蓋或改類型
 
 - Strings with List:
- 對字串使用列表指令
 - 可以顯示第n位字的字串 和 查詢字是否在這字串內
 - 注意: 但不能更改字串內容,想要更改字串可參考Mutable and Immutable:
 
 - random with List:
- 隨機顯示列表內容
 - 利用random模組生產一個亂碼,再利用列表的index來顯示列表內容
 
 - Def with List:
- 用def添加值給List
 - 用def建立name(someParameter),並輸入要添加值的內容,最後將listName丟入someParameter添加值
 
 - list ID:
- 列表共用性
 - 變數值可以互換,因為會複製出新的變數值
 - 列表不可以互換,因為不會複製出新的列表
 
 - copy( ) with List:
- 複製列表
 - 因為列表不會複製出新的列表,所以就要使用copy模組
 
type( ):
.png)
list( ) and tuple( ):
 and tuple( ).png)
Mutable and Immutable:

Strings with List:

random with List:

Def with List:

list ID:

copy( ) with List:
 with List.png)