What is 'String Slicing'?

Asked by stem_mind · 6 months ago

1 Answer

41
amorebise · 6 months ago Top Answer

Slicing is taking a 'slice' of a string, like cutting a piece of bread. You tell Python where to start and where to end.

"Python"[0:2] gives you "Py". It’s a powerful way to extract parts of a message, like taking just the first name from a full name.

Log in to add a comment.