Python – Assignment Operators

Python - Assignment Operators


We will see about 4 assignment operations in Python as below,

  1. Less than
  2. Greater than
  3. Equals to
  4. Not equals to

Less than:

num1= 10
num2= 15
print(num1<num2)

This will check whether num1 is less than num2, in this case yes num1 is less than num2. The output will be True.

Greater than:

print(num1>num2)

Since num1 is less than num2 in this example, the output will be False

Equals to:

print(num1==num2)

== means to check whether the value is equal / same.

As per the example, the output should be False

Not Equals to:

print(num1!=num2)

!= means to check whether it is not equals to

As per the example, the output should be False.



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.