Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python program to switch first and second characters in a string

str = input("Enter a string : ")
new_str = str[-1:] + str[1:-1] + str[:1]
print(new_str)
Source by www.codevscolor.com #
 
PREVIOUS NEXT
Tagged: #python #program #switch #characters #string
ADD COMMENT
Topic
Name
1+8 =