+ 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
3 odpowiedzi
+ 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
+ 2
Thanks a ton Rishi, you are amazing dude
+ 2
Torg Happy to help =)