Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre What is a List? | Data Types
Introduction to Data Analysis in Python
course content

Contenu du cours

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
What is a List?

One of the Sequence Types is list.

It is used to store variables: list_ = [1, 3, 6, 'a', True]. To create a list, you just need to put variables inside square brackets.

You can't name a variable as a data type: list_ is OK.

Indices

The list's first item has the index 0, the next one 1, and so on. If we start from the end, the last item has the index -1, and the second-to-last has the index -2, and so on.

123456
list_ = ['P', 'y', 't', 'h', 'o', 'n'] print('The first item is', list_[0]) print('The third item is', list_[2]) print('The fifth item is', list_[-2]) print('The last item is', list_[-1])
copy
question-icon

Using only negative indexation extract the symbols c o d e from the list_code.

list_code = ['c', 'o', 'd', 'e']
c = list_code[
]
o = list_code

d = list_code

e =

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

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 7

Demandez à l'IA

expand
ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

course content

Contenu du cours

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
What is a List?

One of the Sequence Types is list.

It is used to store variables: list_ = [1, 3, 6, 'a', True]. To create a list, you just need to put variables inside square brackets.

You can't name a variable as a data type: list_ is OK.

Indices

The list's first item has the index 0, the next one 1, and so on. If we start from the end, the last item has the index -1, and the second-to-last has the index -2, and so on.

123456
list_ = ['P', 'y', 't', 'h', 'o', 'n'] print('The first item is', list_[0]) print('The third item is', list_[2]) print('The fifth item is', list_[-2]) print('The last item is', list_[-1])
copy
question-icon

Using only negative indexation extract the symbols c o d e from the list_code.

list_code = ['c', 'o', 'd', 'e']
c = list_code[
]
o = list_code

d = list_code

e =

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

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 7
Nous sommes désolés de vous informer que quelque chose s'est mal passé. Qu'est-il arrivé ?
some-alt