DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
mahajanmohit profile image
Mohit Mahajan

I am new to the coding world so my code may not be that much efficient, but i am happy with the fact that i wrote it.

import sys
def trim_characters(input_string):
return_string=""
#print(return_string)
if (len(input_string))>2:
for i in range(0, len(input_string)):
if i!=0 and i!=len(input_string)-1:
return_string=return_string + input_string[i]
print("Output string : "+ return_string)
else:
print("Minnimum 3 characters are allowed")
trim_characters(sys.argv[1])

Forem Open with the Forem app