python – Syntax for an If statement using a boolean

python – Syntax for an If statement using a boolean

You can change the value of a bool all you want. As for an if:

if randombool == True:

works, but you can also use:

if randombool:

If you want to test whether something is false you can use:

if randombool == False

but you can also use:

if not randombool:

I think You could also just use

if randombool is True:

elif randombool is False:

I dont think you need to use equal signs unless its an int or float.

Correct me if Im wrong

python – Syntax for an If statement using a boolean

Leave a Reply

Your email address will not be published. Required fields are marked *