关于python一个列表的问题!!求大神解答!!

2024-12-27 13:05:17
推荐回答(1个)
回答1:

def is_str_in_string(small_string, big_string):
return small_string in big_string

def has_str_in_string(the_list, big_string):
for small_string in the_list:
if small_string in big_string:
return True
return False

A = ["abc", "ggg"]
B = ["kkk", "sss"]
text = input("请输入:")
while True:
if has_str_in_string(A, text) and has_str_in_string(B, text):
print("Game Over!")
break
text = input("请重新输入:")