print("Hello world"[::-1]) what's happening here | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 4

print("Hello world"[::-1]) what's happening here

I studied lists a little bit and I kinda understand they've reverse listed here to reverse the string but not sure how exactly and could someone share me a few programs that contains listing to understand it better

5th Nov 2021, 6:55 AM
A Mohammed Alhaan
A Mohammed Alhaan - avatar
3 ответов
+ 5
Look at this code. It prints the string in reverse order. The string indexing operator has 3 arguments. The first is the starting index(0 by default). The second is the ending index+1(default is the last index+1). The third argument is the step value. It indicates how many characters to move forward after printing the first character. It can have negative values and print the string in opposite order. Refer my code below https://code.sololearn.com/cLX2qRO7jEOw/?ref=app
5th Nov 2021, 7:02 AM
Rishi
Rishi - avatar
+ 2
Thanks a ton Rishi, you are amazing dude
5th Nov 2021, 1:12 PM
A Mohammed Alhaan
A Mohammed Alhaan - avatar
+ 2
Torg Happy to help =)
5th Nov 2021, 2:28 PM
Rishi
Rishi - avatar