Portfolio by TUĞBA YILDIRIM
  • Home
  • About me
  • Projects
  • Tutorials
  • Resume
  • Contact

Python: Operations

COMPARISION, LOGICAL, MEMBERSHIP OPERATIONS

Operations allow you to perform actions on variables and values.

A- Comparison Operations

Comparison operations are the simplest. To summarize briefly:


• == equals

• != not equal

• > greater than

• < less than

• >= greater than or equal to

• <= less than or equal to

The result of these operations is either True or False.

Note: You can also compare strings (character data). The character that comes later in the alphabet is always greater. For example, "Ayşe < Zeliha" is correct.

Example Image

B- Logical Operations

• And: Returns True if both values you provide are True.

• Or: Returns True if at least one of the values you provide is True.

• Not: Returns the opposite of the given value. If the result is True, it becomes False.

Example Image

C- Membership Operations

• In: Returns True if the value you are checking exists within the provided sequence (list, string, or other sequence).

• Not in: Returns True if the value you are checking does not exist within the provided sequence.

Example Image

Now you have a solid understanding of operations in Python, the essential tools for manipulating and evaluating data!

  • 
  • 
  • © Untitled
  • Design: HTML5 UP