- 1

Hi there : iam just begin learning python. Asking how to convert data type from int to boolean? How i write it

13th Oct 2020, 10:46 AM
Ahmed M. Elmolla
Ahmed M. Elmolla - avatar
2 Antworten
+ 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)
13th Oct 2020, 11:04 AM
Théophile
Théophile - avatar
13th Oct 2020, 11:05 AM
Zerokles
Zerokles - avatar