Write a python program to create a new string made of an input string’s first, middle, and last character.
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
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