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

3rd Nov 2016, 3:11 AM
Nelson20
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")
3rd Nov 2016, 6:40 AM
Gina Isvoranu
Gina Isvoranu - avatar
0
yes, thank you a lot
3rd Nov 2016, 12:09 PM
Nelson20
0
I'm glad I could help you.
4th Nov 2016, 6:22 AM
Gina Isvoranu
Gina Isvoranu - avatar