Hello ,

Let's say I have :

def mine( a, b ):
    return a>=b - 1

I can't understand what's going on with the -1.

So , if a = 4 , b = 2 , it gives True
If the opposite it gives False.

As I said I don't know about the -1 here ( or generally whatever follows the initial a>=b )


Recommended Answers

Hello. It is the same as

def mine(a, b):
    return a >= (b - 1)

see https://docs.python.org/3/reference/expressions.html#operator-precedence

Jump to Post

All 2 Replies

Oh!I didn't know that!
Thanks a lot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.