Membership operator

 Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

>>> ##membership operators->in, not in

>>> ##return a bool-> T or F

>>> believer="merciful"

>>> "r" in string

Traceback (most recent call last):

  File "<pyshell#3>", line 1, in <module>

    "r" in string

NameError: name 'string' is not defined

>>> r in believer

Traceback (most recent call last):

  File "<pyshell#4>", line 1, in <module>

    r in believer

NameError: name 'r' is not defined

>>> string="merciful"

>>> "r" in string

True

>>> "erc" in string

True

>>> "ei" in string

False

>>> >> "arz" in Aamiraarza

Traceback (most recent call last):

  File "<pyshell#9>", line 1, in <module>

    "arz" in Aamiraarza

NameError: name 'Aamiraarza' is not defined

>>> "arz" in "Aamirarz"

True

>>> 

Comments

Popular posts from this blog

XAMPP, SQL BASIC COMMANDS

The Minion Game Hackerrank Solution

Arrays - DS | HackerRank Solutions