Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Slice » ?

Definition 21.2 Primary & Middle School Computer Science · Chapitre 21 — Strings

A slice is a part of a string (or of a list) taken by indices: s[a:b] holds the characters from index aa up to index bb, but without bb. Without aa, the slice starts at the beginning; without bb, it goes to the end; s[::-1] walks backwards and gives the string reversed.

Think of the indices as standing between the characters: the slice [a:b] takes what lies between the marks a and b.
Think of the indices as standing between the characters: the slice [a:b] takes what lies between the marks aa and bb.
Lire dans le chapitre →