0
Is there any function to check is something is a memebr of a list/tuple? In python
I need a function to check if a number is in the list, like the, 'belongs to' function of math, I know how to make such function but I want to know if there is any default function
1 Odpowiedź
+ 1
arr=[1,2,3]
set={1,2,3}
dict={1:'a', 2:'b', 3:'c'}
tup=(1,2,3)
print(3 in arr)
print(3 in set)
print(3 in dict)
print(3 in tup)
Prints True for each of these. Could it be any simpler? I dont think so...