How do I check if a boolean is true or false?

A boolean value can go directly into a conditional (if) statement

if programRepeated:

If programRepeated is equal to true, then the code block will execute.

Some notes on your code though: = is an assignment operator. If you would like to check if something is equal, please use two equal signs ==. Your code will throw a syntax error if you try to use = in a conditional.

Also, your elif should be on the same indentation as the if statement, and you can use else instead in this case.

if programRepeated:
     print("Your balance is : $" , final_balance + cash_insert)
     print("")
else:
     print("Your balance is : $" , final_balance + cash_insert - 5)
     print("")

Leave a Comment