Tell us what’s happening:
hay can some one explain that what is start stop and step means like why it scramble all the litter i don’ understand Here’s the syntax for that:
Example Code
string[start:stop:step]
In the example below, the slicing starts at index 0, stops before 11, and extracts every second character:
Example Code
my_str = ‘Hello world’
print(my_str[0:11:2]) # Hlowrd
A helpful trick you can do with the step parameter is to reverse a string by setting step to -1, and leaving start and stop blank:
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Introduction to Strings - What Are Some Common String Methods?