Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

True or false and not true [Python]

Well, i'm stumped. I have gotten everything in the following script right except Bool 2, and i don't know why. I'll try and explain below why i'm confused:

Code
# False or not True and True
bool_one = False

# False and not True or True  
bool_two = False

# True and not (False or False)
bool_three = True

# not not True or False and not True
bool_four = True

# False or not (True and True)
bool_five = False

For bool 2 it says "False and not True or True" which translates to me as "False and False" Because "True or True" is True, and adding "Not" to any statement that's True makes it False so you woud be left with "False and False" What am i missing?
In bool2 since the first false comes along with the and irrespective of the statements that comes after it the expression will be reduced to false. I did not quite get what you were trying to tell, perhaps you could clarify.
(Jun 9, 2013 10:11 PM)coditor Wrote:  In bool2 since the first false comes along with the and irrespective of the statements that comes after it the expression will be reduced to false. I did not quite get what you were trying to tell, perhaps you could clarify.

Im basically asking why the second Bool is True not False.
Indeed bool2=false, I dont see where you could be going wrong.
(Jun 9, 2013 10:25 PM)coditor Wrote:  Indeed bool2=false, I dont see where you could be going wrong.

That's what i though, but it's telling me it's True. Any ideas why?
Well in this expression False and not True or True , it would simplify to 'false and false or true' which would simplify to true. I think you meant
'false and not (true or true)' which would have given false. Too bad I got it wrong.
(Jun 9, 2013 10:34 PM)coditor Wrote:  Well in this expression False and not True or True , it would simplify to 'false and false or true' which would simplify to true. I think you meant
'false and not (true or true)' which would have given false. Too bad I got it wrong.

Oh, i understand now. Thanks for breaking it down.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[C#] by thibautSep 13, 2015 06:53 AM 5 163 Sep 13, 2015 06:53 AM
Last Post: thibaut
[Python] by theChiveMar 12, 2015 11:13 AM 4 135 Mar 12, 2015 11:13 AM
Last Post: lockhead