The difference between python's * and two * *, two less than signs in python

Hello everyone, this article will focus on the difference between two equal signs and one equal sign in python. Why python uses two equal signs is a matter that many people want to understand. I want to figure out python's * and two * The difference requires understanding the following things.

5dd37ff5e6ad8751.jpg

Comparison operators, also known as relational operators, are used to compare the results of constants, variables or expressions in terms of size, true or false, etc. If the comparison result is true, it returns True; otherwise, it returns False. The comparison operators supported by Python are shown in the figure below

1565681409308149.png

Basic usage: >>> print("Is 5 greater than 4:", 5 > 4)

Is 5 greater than 4: True

>>> print("Is the 4th power of 3 greater than or equal to 90.0:", 3 ** 4 >= 90)

Whether 3 to the 4th power is greater than or equal to 90.0: False

>>> print("Is 20 greater than or equal to 20.0:", 20 >= 20.0)

Whether 20 is greater than or equal to 20.0: True

>>> print("Are 5 and 5.0 equal:", 5 == 5.0)

Whether 5 and 5.0 are equal: True

>>> print("True and False are equal:", True == False)

Are True and False equal: False

>>>

Compare

Guess you like

Origin blog.csdn.net/chatgpt001/article/details/132081243
Recommended