(6/10)

Adding To A List (List Methods) — Python typing lesson

Learn to add and modify items in Python lists.

What you'll practice

Let's add a new toy to our toy box! We can use the special command .append() to add items to the end of a list.

  • `.append()` is a special command attached to the list variable.
  • The item you want to add goes inside the parentheses.
🐍Python

Adding To A List (List Methods)

0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
5
toy_box = ['robot', 'car']↵
print(toy_box)↵
toy_box.append('train')↵
print('I got a new toy!')↵
print(toy_box)
0 / 106
Press This!
👇
`~
1!
2@
3#
4$
5%
6^
7&
8*
9(
0)
-_
=+
⌫
⇥
Q
W
E
R
T
Y
U
I
O
P
[{
]}
\|
⇪
A
S
D
F
G
H
J
K
L
;:
'"
↵
⇧
Z
X
C
V
B
N
M
,<
.>
/?
⇧
Thumb
Index
Middle
Ring
Pinky