CBSE 11TH CLASS CS PROGRAM 14

 

14. Input a list/tuple of elements, search for a given element in the list/tuple.

Python

elements = [10, 5, 20, 3, 8]

search_element = int(input("Enter the element to search for: "))

 

if search_element in elements:

    print(search_element, "found in the list")

else:

    print(search_element, "not found in the list")

No comments:

Post a Comment