+ 1

Can someone tell why this happens? (Check the code below)

https://code.sololearn.com/cY93L13Dp9a1/?ref=app

14th Feb 2021, 12:49 PM
PHILOMATH PRATIK
PHILOMATH PRATIK - avatar
3 Answers
+ 9
Hey! I can help you with this (the others I didn't even understand 😅) Like in your example: print(Strange_happening[::-1]) This reverse a string. Like "HOME" becomes - > "EMOH" Hope it helps a bit :)
14th Feb 2021, 12:52 PM
Matthew
Matthew - avatar
+ 4
in addition to Matteo đŸ—œ comment , when the value is more than 1 you can simply escape some characters , for example when you write str[::-2] you reverse the string at first then you take character i and escape i+1 for example "hello"[::-2] take o leave l take the first l and leave e take h and leave nothing and so on
14th Feb 2021, 1:02 PM
ABADA S
ABADA S - avatar