You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
def string_both_ends(str):
|
|
if len(str) < 2:
|
|
return ''
|
|
|
|
return str[0:2] + str[-2:]
|
|
|
|
print(string_both_ends('w3resource'))
|
|
print(string_both_ends('w3'))
|
|
print(string_both_ends('w')) |