Difference between revisions of "Code Snippet: Print String Backwards"
From Coder Merlin
NerdOfLinux (talk | contribs) |
|||
Line 10: | Line 10: | ||
== Python == | == Python == | ||
<syntaxhighlight lang="python"> | |||
string = "That Which Survives" | |||
# Short & Fast | |||
print(string[::-1]) | |||
# More readable | |||
print(''.join(reversed(string))) | |||
</syntaxhighlight> | |||
[https://stackoverflow.com/questions/931092/reverse-a-string-in-python Source] |
Revision as of 17:39, 24 December 2018
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder