Interview Question

What is slicing?

Slicing uses start:stop:step and excludes the stop position.

💡 Concept ✅ Quick Revision 🐍 Python

Answer

Slicing selects a range from a sequence using start, stop, and step values. • The stop index is excluded. • Omitted bounds use sequence defaults. • Many built-in sequence slices create a new object.

💡 Simple Example

text = 'Python' print(text[1:5]) print(text[::-1])

Output

ytho nohtyP

⚡ Quick Revision

Slicing uses start:stop:step and excludes the stop position.