In this article, we will be covering conver a Boolean type variable to an integer in Pythonin.
In Python, we can convert a boolean type variable we declared earlier to an integer surrogate representation of integer as 1 or 0. In that case, TRUE type boolean variable gets converted to integer 1, and FALSE type boolean variable gets converted to 0 as result.
Below is the code example of converting Boolean variable to integer in Python
# convert boolean to int
var = True
print (int(var))
Below is its output. We call that variable with printf to display in screen.