【发布时间】:2018-01-12 09:54:23
【问题描述】:
about_pet = input("A sentence about your pet")
multi = "dog", "cat"
if all(multi) in about_pet:
print ("wow, you have one more pets!", " Thanking you reading my
story:) ")
elif "dog" in about_pet:
print ("Ah, a dog.", " Thanking you reading my story:) ")
elif "cat" in about_pet:
print ("Oh, a cat.", " Thanking you reading my story:) ")
我不知道如何在输入中搜索两个字符串。以上捕获的是我所做的。
【问题讨论】:
-
if all(pet in about_pet for pet in multi) -
这是stackoverflow.com/questions/3271478/… 的副本。全部用错了
标签: python