logo-MindMajix
PostPythonPython
s
sri kanth

Posted on 20th July 2024|15 views

0
votes

Python If In

What is the use of if with in, in python?

1 answers
Answers
P
veerubhotla sowmithri

Posted on 20th July 2024| views

In operator is used for membership testing, which tells us if there is a value within the other value. For example, A in B returns true if there is a value called A within B, and when B does not contain A, it returns false.

Here is an example of a python program

My_example = "mindmajix is the best place to learn".

if 'mind' in My_example:

print("found the required string")

else:

print("there is no required string")

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number