Questions
Write a python program to search for a given element in an list.
Last Updated : 26 Jul 2026
Jul 23
Solution:
# Define the list and the target element
languages = ["Python", "Java", "C++", "JavaScript", "Go"]
target = "C++"
# Check membership using the 'in' operator
if target in languages:
print(f"'{target}' was found in the list!")
else:
print(f"'{target}' was not found.")
Report an error