n=input("enter the no:")
check(test_list,n)
def check(test_list,n):
for i in test_list:
if(i==n):
print("yes in a list")
continue
else:
continue
I had written the simple code to check if a no. exists in a list or not, but while taking user input I"m not getting any results after providing input value n.
Why is so?
You were not getting any results because the input() function always returns a string. For this reason, we need to convert it to an Integer before passing it on into the function, and I did with
n=int(input()).