Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Slice?

Definition 21.2 Primary & Middle School Computer Science · Capítulo 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.
Leer en el capítulo →