Python Forum
bool b = (num == 100) this doesn't work? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: bool b = (num == 100) this doesn't work? (/thread-27582.html)



bool b = (num == 100) this doesn't work? - MelonMusk - Jun-11-2020

bool b = num == 100
why this doesn't work?


RE: bool b = (num == 100) this doesn't work? - menator01 - Jun-12-2020

num = 100
bool(num)
bool(num) == 100
num == 100
b = num == 100
b
Output:
True False True True



RE: bool b = (num == 100) this doesn't work? - bowlofred - Jun-12-2020

What do you expect that line to do?

Python doesn't declare the type of the variable, so you wouldn't say
int x = 10
So if you get rid of the bool at front you end up with

b = num == 100
which can be parsed as

b = (num == 100)