Write a python program to create a new string made of an input string’s first, middle, and last character.
belongs to collection: Python String Exercises
All Answers
total answers (1)
belongs to collection: Python String Exercises
total answers (1)
Hint:
Solution:
str1[0]
to get the first character of a string and add it to theresult
variablex = len(str1) /2
. Usestr1[x]
to get the middle character and add it to theresult
variablestr1[len(str1)-1]
to get the last character of a string and add it to theresult
variableresult
variable to display new string