KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

What is the purpose of the 'in' operator in Python?

  1. To check if a value exists in a sequence
  2. To start a loop
  3. To create a function
  4. To define a variable

Python Control Flow

3 Likes

Answer

To check if a value exists in a sequence

Reason — The in operator is a membership operator used to check whether a particular value is present in a sequence such as a list, tuple, string, or set. It returns True if the value is found in the sequence and False otherwise.

Answered By

1 Like


Related Questions