Skip to content

Instantly share code, notes, and snippets.

@Ra1d7
Last active March 29, 2022 15:32
Show Gist options
  • Save Ra1d7/3640126bbe2baacb8ae2eaf62e391346 to your computer and use it in GitHub Desktop.
Save Ra1d7/3640126bbe2baacb8ae2eaf62e391346 to your computer and use it in GitHub Desktop.
words = input('String to reverse: ').split(' ')
reverselist = []
reversestring=''
numofwords = len(words)-1
for x in range(0,numofwords):
reverselist.append(words[numofwords-x])
reverselist.append(words[0])
for item in reverselist:
reversestring += ' ' + item
print(reversestring)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment