Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: dummy variables pandas 
Python :: python character list to string 
Python :: django start project 
Python :: check if a value is nan pandas 
Python :: python search first occurrence in string 
Python :: python mettre en minuscule 
Python :: show all rows for dataframe 
Python :: droping Duplicates 
Python :: How to efficiently calculate the nth Catalan number, in Python? 
Python :: python read json file array 
Python :: python create venv 
Python :: Python function to compute factorial of a number. 
Python :: plot pil image colab 
Python :: how to install python libraries using pip 
Python :: custom jupyter notebook 
Python :: position in array python 
Python :: embed image in html from python 
Python :: difference between set and tuple in python 
Python :: declaring variables in python 
Python :: how to update sklearn 
Python :: python pillow cut image in half 
Python :: how to add the sum of multiple columns into another column in a dataframe 
Python :: creating numpy array using zeros 
Python :: python time sleep 
Python :: huggingface transformers change download path 
Python :: how to install ffmpeg python heroku 
Python :: python insert list 
Python :: dijkstras python 
Python :: create python list 
Python :: Matplotlib rotated xticklabels 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =