write a short note on python membership with suitable example
Answers
Answered by
4
The membership operators in Python are used to test whether a value is found within a sequence. For example, you can use the membership operators to test for the presence of a substring in a string. Two membership operators exist in Python:
in – evaluates to True if the value in the left operand appears in the sequence found in the right operand. For example, ‘Hello’ in ‘Hello world’ returns True because the substring Hello is present in the string Hello world!.
not in – evaluates to True if the value in the left operand doesn’t appear in the sequence found in the right operand. For example, ‘house’ in ‘Hello world’ returns True because the substring house is not present in the string Hello world!.
Answered by
2
Mark the upper One as BRAINLIEST ❤
Similar questions
Computer Science,
2 months ago
Social Sciences,
2 months ago
Math,
5 months ago
Math,
10 months ago
Math,
10 months ago
Math,
10 months ago