- 1
Hi there : iam just begin learning python. Asking how to convert data type from int to boolean? How i write it
2 odpowiedzi
+ 1
You want to convert an int to a boolean?
It is not necessary, since in python True is literally 1 (or all non-zero value) and False is literally 0.
If you really want to convert it, do :
b = bool(integer)
+ 1
You can use the bool() function.
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_booleans.asp