Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python reverse a string

# Slice notation takes the form [start:stop:step]. In this case, 
# we omit the start and stop positions since we want the whole string. 
# We also use step = -1, which means, "repeatedly step from right to left by 
# 1 character".

'hello world'[::-1]

# result: 'dlrow olleh'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #reverse #string
ADD COMMENT
Topic
Name
9+3 =