0

Python: Doubts in slicing

Here is the print statement and i want to understand the output of the statement and the reason? Print(ā€˜game of diceā€™[::-3])

16th Apr 2020, 9:51 AM
pranavi Reddy
pranavi Reddy - avatar
5 Answers
0
The output will be backwards with a step of 3. Output - edom Note : it counts spaces too
16th Apr 2020, 10:08 AM
Varun Vaswani
Varun Vaswani - avatar
0
It's starts from the end of the list 'e' moves with a step of 3 Output --> 'edom'
16th Apr 2020, 10:21 AM
Justus
Justus - avatar
0
Yes, Justus is right and I corrected my code recently...
16th Apr 2020, 10:23 AM
Varun Vaswani
Varun Vaswani - avatar
0
Varun Vaswani and Justus : thanks for answering
16th Apr 2020, 1:48 PM
pranavi Reddy
pranavi Reddy - avatar
0
You're welcome
16th Apr 2020, 1:49 PM
Varun Vaswani
Varun Vaswani - avatar