1thislist = ["apple", "banana", "cherry"]
2if "apple" in thislist:
3 print("Yes, 'apple' is in the fruits list")
1thelist = ["apple", "avocado", "banana"]
2
3inpt = input("Check an item in the list: ")
4
5if inpt in thelist:
6 print(inpt, "is in the list!")
1# To check if a certain element is contained in a list use 'in'
2bikes = ['trek', 'redline', 'giant']
3'trek' in bikes
4# Output:
5# True
1listA = [item1, item2, item3]
2if item4 in listA:
3 print('yes, item4 is in the list')
4else:
5 print('no, item4 is not in the list')