Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What is slicing?
Home
Python Flask
What is slicing?
0
votes
asked
May 10, 2023
in
Python Flask
by
john ganales
What is slicing?
slicing
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 10, 2023
by
john ganales
Slicing is a technique that allows us to retrieve only a part of a list, tuple, or string. For this, we use the slicing operator [].
>>> (1,2,3,4,5)[2:4]
(3, 4)
>>> [7,6,8,5,9][2:]
[8, 5, 9]
>>> 'Hello'[:-1]
‘Hell’
...