Wednesday, July 8, 2015

Python Program to Read an list and Search for an Element

list=[1,2,3,4,5]
print "Enter element to find"
num=raw_input("Enter number")

for item in list:
    if item == int(num):
        print "Element found"
        break
    else:
        print "Element not found"
        break

No comments:

Post a Comment