나는 이렇게 학습한다/Algorithm & SQL
1218. Remove First and Last Character
daco2020
2022. 12. 18. 19:54
It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less than two characters.
Solution:
def remove_char(s: str, limit: int = 1):
return s[limit:-limit]