0 like 0 dislike
284 views
in Examples, Exercises and Projects by Goeduhub's Expert (7.8k points)
If the string length is less than 2, return instead of the empty string.

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.8k points)
 
Best answer
c = input()
t = len(c)
temp = ""
for i in range(0,len(c)):
    if t<3:
        break
    else:
        if i in (0,1,t-2,t-1):
            temp = temp+c[i]
        else:
            continue
print(temp)
...