Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer How to Append New Element? | Introduction to Python 1/2
Introduction to Python for Data Analysis

book
How to Append New Element?

Let's move to methods that we can apply to our list. The first one is append(), which adds the item to the end of the list. Look at the example:

word = ['c', 'a', 't']
word.append('s')
print(word)
123
word = ['c', 'a', 't'] word.append('s') print(word)
copy

Everything is easy! It is your turn to practice.

If you want to dive deeper into data types, you can take a Python Data Types course.

question-icon

Drag the items of code below to make the output look like this 'My favorite holiday is Christmas'. To do it, just append the 'Christmas' string.

holiday = ['My favorite holiday is']
___
___
___
___
___
___

Click or drag`n`drop items and fill in the blanks

dots
)
dots
append
dots
(
dots
holiday
dots
.
dots
'Christmas'

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 13

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt