# Using if statement if ele in seq: statement(s) # Using for statement for ele in seq: statement(s)
Note: in is a keyword (case-sensitive) in python,
Python in keyword examples
Simple example code program to demonstrate use in keywords to check whether an element exists in the given sequence like string, list, tuple, etc.
Using if statement
fruits = ["Apple", "Orange", "Cherry"] # Check if Apple in list if "Apple" in fruits: print("Yes 'Apple' in List")
Using for statement
fruits = ["Apple", "Orange", "Cherry"] # Print list for x in fruits: print(x)
Do comment if you have any doubts and suggestions on this Python keyword tutorial.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.