Converting Boolean values to numbers

1

How do I make the response from False be 0 and True to 1

equal to C?

That is, I want the answer from: u=(1>2)

is 0 and not False ?

Thank you

    
asked by anonymous 11.04.2018 / 19:51

1 answer

3

Just cast for int

u=(1>2)
print(int(u))
    
11.04.2018 / 20:15