Python Membership Operators

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

1. How does a computer work?

2. What are different computer languages?


3. What are the different features of python?
4. What are the different modes of Python?
5. Which all separators can be used with print function?
6. What does type function do?
7. What does input function do?
8. What are the different data types?
9. What are different types of operators in python?
10. How do you write single line comment and multiple line comments in python?
11. What are different types of control structures in Python?
12. What do you mean by iterative statement? Write all types of iterative statements available in Python?
13. Mention the other name for iterative statements?
14. Which function is used to check the range in loop?
15. What is infinite loop?
16. Whether while and for loops are entry controlled loop or exit controlled and WHY?

Python Membership Operators

These operators help validate whether a given element is a member of the given sequence of data. This
sequence of data can be a list.

Example:

1. in Operator

first_list = [1,2,3,'a']

second_list = ['a','b','c',10]

# loop around the list

for i in first_list:

if i in second_list:

print(i,"is present in both lists")

2. not in Operator:

my_new_list = [1,2,3, 'a']


special = 'Studytonight'
if special not in my_new_list:
print('True')

You might also like