Get The Most Affordable Hosting in the World!
Starting at just $1.87/month, Vercaa offers unbeatable pricing for world-class web hosting services.
Fast, reliable, and secure hosting to power your website without breaking the bank. Plus, enjoy a free CDN for faster loading times worldwide!
Get Started Now!In Python, bool is a sub-type of int type. A bool object has two possible values, and it is initialized with Python keywords, True and False.
A bool object is accepted as argument to type conversion functions. With True as argument, the int() function returns 1, float() returns 1.0; whereas for False, they return 0 and 0.0 respectively. We have a one argument version of complex() function.
If the argument is a complex object, it is taken as real part, setting the imaginary coefficient to 0.
On running this code, you will get the following output −
bool to int: 1 bool to float: 0.0 bool to complex: (1+0j)
The End! should you have any inquiries, we encourage you to reach out to the Vercaa Support Center without hesitation.