0
Hi. Explain this python string rotation program
Since this is one-liner. I didn't get anything. pls break this code and explain. https://code.sololearn.com/cjAUZf32GPg5/?ref=app
2 Réponses
+ 4
Here it is in 3 lines
string = input()
for i in range(len(string)):
print(string[i:] + string[:i])
+ 2
input() | Takes an input,
for i in range(len(x)) | loops through the index values for the string based on string length
lambda x: [x[i:]+x[:i] | Take every letter after i character(including i) and then put every character before i