+ 1
Someone please exaplain me this!!! :- == , <= , >=
4 ответов
+ 5
== (we use this to compare if two variable are equal)
>=(Greater than or equal)
<= ( Lessthan or equal)
+ 4
Hi!
== equality operator
<= less than or equal to
>= greater than or equal to
Try them!
Take a look here:
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_operators.asp
+ 1
There are no operator like :- in Python.
Maybe it’s a part of syntax connected to slices:
>>> myList = [1, 3, 5, 7, 9]
>>> res = myList[:-1]
>>> print(res)
[1, 3, 5, 7]
>>>
It means: take all the elements from the lists begining to the last element in the list (but not the last element), and (shallow) copy them to a new list. So :- is a colon (:), and a minus (-).
Or maybe you mean := that is a new way to assign variables inside expression (from Python 3.8), like in:
>>> myList = [1, 3, 5, 7, 9]
>>> print((lenght := len(myList)) + lenght//2)
7
>>>
instead of:
>>> myList = [1, 3, 5, 7, 9]
>>> print(len(myList) + len(myList)//2)
7
>>>
0
Thank you all 👍🤗