Python Forum
Python greater than equal to comparison operator
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python greater than equal to comparison operator
#1
Dear All,

This question might sound very basic and simple. However, I'm confused over the output which I'm getting in python 3.8.0 terminal.

Operator:- Greater than equal to >=
Say if x>=y To evaluate to true the x value should be greater than equal to y.

Case 1:
1>=1
True
Case 2:
2>=1
True
In case 2, though 2 is greater than 1 but not equal to 1. So, why it is still giving the true as output Sad

Please advice.
Reply
#2
The operator means "greater than or equal to", as it does in mathematics, so it returns True if either x > y or x == y.
Reply
#3
It's interesting what your understsnding is, i.e. it's clear one number cannot be both equal to and greater than other
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
Dear Buran,

Thank you very much for solving the confusion:)
Reply
#5
(Sep-26-2020, 12:07 AM)Ilangos Wrote: Dear Buran,

Thank you very much for solving the confusion
I thought @ndc85430 solved the confusion...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python rule about the space character surrounding the equal sign ineuw 10 1,614 Sep-21-2023, 09:17 AM
Last Post: ineuw
Photo String comparison in a csv file in Python Pandas fleafy 2 1,150 Nov-18-2022, 09:38 PM
Last Post: fleafy
  is there equal syntax to "dir /s /b" kucingkembar 2 981 Aug-16-2022, 08:26 AM
Last Post: kucingkembar
  Can a variable equal 2 things? Extra 4 1,480 Jan-18-2022, 09:21 PM
Last Post: Extra
  RuntimeWarning: invalid value encountered in greater Lukas 2 3,749 May-28-2020, 05:50 AM
Last Post: ndc85430
  Python logical operator AND rasec70 4 2,516 May-07-2020, 03:40 PM
Last Post: pyzyx3qwerty
  Use of & operator, groupby in python abhi1693r 0 1,586 Mar-11-2020, 02:25 PM
Last Post: abhi1693r
  Not equal a dictionary key value bazcurtis 2 1,916 Dec-11-2019, 11:15 PM
Last Post: bazcurtis
  Comparison Operator "is" idle vs python command spisatus 3 2,773 Oct-29-2019, 10:00 PM
Last Post: DeaD_EyE
  Problem with comparison operator mdrisser 2 2,347 Feb-28-2019, 09:45 PM
Last Post: mdrisser

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020