判断字符串 a = “welcome to my world” 是否包含单词 b = “world”,包含返回 True,不包含返回 False

#判断字符串 a = “welcome to my world” 是否包含单词 b = “world”,包含返回 True,不包含返回 False
def test():
a = "welcome to my world"
b="world"
if b in a:
return True
else:
return False
print(test())

 

posted @ 2024-02-20 16:52  琳达的博客  阅读(46)  评论(0编辑  收藏  举报