0
Element in a list
Hello, can anyone help me how to do this program? I have to create a program that let the user enter a value and if the value is the same as any value in a list, it has to print the value , else it has to print "not found" Something like this: list=[1,2,3] value=int (input ("Enter the value:")) and Well if the value entered for the user is the same as a value in the list it has to print that value... Please help
3 Answers
+ 1
Something like this?
list = [1, 2, 3]
value = int(input("Enter the value: "))
if value in list:
print (value)
else:
print ("not found")
0
yes, thank you a lot
0
I'm glad I could help you.