Replacing First Element with Middle Element of a String in Python

VenkatNarayan.K Mar 01, 2021

Python Program to remove the middle element of a string which is got from the user and replacing the first element with that middle element

A String is given as an input and the middle element of a string is found. The middle element is identified by performing floor division to the length of the string. For an unequal string length, the element which is close to the centre is taken as the middle element. The next step is replacing the first element with the identified middle element. The output string is displayed with the first letter altered. This program works for both lowercase and uppercase characters. 

Project Files

Loading...
..
This directory is empty.

Comments (0)

Leave a Comment