OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

True False boolean not recognized? [closed]

  • Thread starter Thread starter Steve Roberts
  • Start date Start date
S

Steve Roberts

Guest
How is it possible that a True or False boolean is not recognized as such?

Code:
print(f"before {self.reverse_maze}")
if self.reverse_maze:
    print(f"after {self.reverse_maze}")

output is this:

Code:
before False
after False

I tried using if not and that stopped the 2nd output 'after', but 'if' should be True then how it is possible that 'after' statement would be printing has me at a loss
<p>How is it possible that a True or False boolean is not recognized as such?</p>
<pre class="lang-py prettyprint-override"><code>print(f"before {self.reverse_maze}")
if self.reverse_maze:
print(f"after {self.reverse_maze}")
</code></pre>
<p>output is this:</p>
<pre class="lang-none prettyprint-override"><code>before False
after False
</code></pre>
<p>I tried using if not and that stopped the 2nd output 'after', but 'if' should be True then how it is possible that 'after' statement would be printing has me at a loss</p>
 

Online statistics

Members online
0
Guests online
3
Total visitors
3
Top