Loading

Remove First and Last Character

Instructions
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):
    return s[1 : -1]

a_string[start : end] : 返回一个字符串类型,返回的数据是原字符串第2个字符倒数第2个字符之间所有字符组成的字符串

posted @ 2023-03-15 22:29  Artwalker  阅读(29)  评论(0)    收藏  举报
Live2D