SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
A_list
=
[
"Banana"
,
255
,
False
,
3.14
]
(A_list[
-
1
])
>>> %Run -c $EDITOR_CONTENT
[3.14]
Print the second, third item:
A_list
=
[
"Banana"
,
255
,
False
,
3.14
]
(A_list[
1
:
3
])
>>> %Run -c $EDITOR_CONTENT
[255, False]
Change List Items
Change the second, third item:
A_list
=
[
"Banana"
,
255
,
False
,
3.14
]
A_list[
1
:
3
]
=
[
True
,
"Orange"
]
(A_list)
>>> %Run -c $EDITOR_CONTENT
['Banana', True, 'Orange', 3.14]
Change the second value by replacing it with two values:
A_list
=
[
"Banana"
,
255
,
False
,
3.14
]
A_list[
1
:
2
]
=
[
True
,
"Orange"
]
(A_list)
>>> %Run -c $EDITOR_CONTENT
['Banana', True, 'Orange', False, 3.14]
Add List Items
Using the append() method to add an item:
C_list
=
[
"Red"
,
"Blue"
,
"Green"
]
C_list
.
append(
"Orange"
)
(C_list)
>>> %Run -c $EDITOR_CONTENT
['Red', 'Blue', 'Green', 'Orange']
Insert an item as the second position:
C_list
=
[
"Red"
,
"Blue"
,
"Green"
]
C_list
.
insert(
1
,
"Orange"
)
(C_list)
134
Chapter 3. For MicroPython User
Summary of Contents for Thales Kit
Page 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Page 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Page 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...