5 Respuestas
- 1
This would work for a sentence.
sentence = input().split()
for words in sentence:
newSentence = words[1:]+words[0]
print(newSentence,end=" ")
Edit: code modified.
+ 2
string = string[1:] + string[0]
+ 2
suppose the word is,
a= "hello"
since string is an array of characters you can use indexing and slicing to do something like this => newWord=a[1:]+a[0]
+ 1
Avinesh split() will return a list, you're not required to convert it into a list again.
+ 1
QTWizard my bad, thanks for the correction.