Python program to get a string made of the first 2 and the last 2 chars from a given a string.

Опубликовано: 13 Май 2026
на канале: DevOps Rulers
2,988
27

Problem on String:

String: Any sequence of character within single quote or double quote is considered as string.

Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string.
If the string length is less than 2, return instead of that empty string.

String1 : 'Elephant'
Result : 'Elnt'
String2 : 'or'
Result : 'oror'
String3 : 'E'
Result : Empty String

Thankyou for watching

#python #programming #coding #programmer #developer #code #software #tech #pythonproblem #string