题解 | #改变单词游戏#
改变单词游戏
https://www.nowcoder.com/practice/a934515e28a54d3f85bc2c272989be9e
def main(): s1 = input() s2 = input() try: lists = s1.split(' ') lists = list(filter(lambda x: x, lists)) #过滤掉空字符 print(lists) #第一行输出原始单词组成的列表; del lists[-1] print(lists) #第二行输出去掉末尾元素后的列表; lists.append(s2) print(lists) #第三行输出添加新字符后的列表。 except Exception as e: print(str(e)) if __name__ == '__main__': main()