python:请定义一个函数check(),要求接收两个参数,分别是s(字符串),list(列表)。函数功能:测试list里的元素是否都在s里,若是则返回True,否则返回False
1条回答 默认 最新
threenewbee 2020-03-26 20:05关注def check(s, list): for x in list: if x in s: return True return False解决 无用评论 打赏 举报
python:请定义一个函数check(),要求接收两个参数,分别是s(字符串),list(列表)。函数功能:测试list里的元素是否都在s里,若是则返回True,否则返回False
def check(s, list):
for x in list:
if x in s: return True
return False