0

What can I do if I want to check that the input is containing the elements from the list ?(py)

List = (tyh,yaa,) Input:tyhuha Output:true

15th Aug 2020, 7:21 AM
Shubham Ingale
Shubham Ingale - avatar
3 Respuestas
15th Aug 2020, 7:33 AM
Slick
Slick - avatar
15th Aug 2020, 7:36 AM
Shubham Ingale
Shubham Ingale - avatar
0
Use "in" operator to check whether the i/p contains elements from the list. Like, l=["tyh", "yaa"] n=input() for i in l: if i in n: print("True") break else: print("False") break And hope there might be many short codes than this.. But, remember lists are represented using [ ] if it's tuple, what you used there was crt. If it's list plz change..
15th Aug 2020, 7:35 AM
sarada lakshmi
sarada lakshmi - avatar