Tuesday, September 27, 2011

LPTHW Exercise 28

In this exercise we work with boolean and equality operators in Python. Interestingly Python uses the words 'and' 'or' 'not' for boolean operators, instead of '&&' '||'. Python also uses the words 'True' and 'False' to denote the boolean types true, and false respectively.

I completed the exercise which was to evaluate some logic statements and correctly guess what the answer should be.

For extra credits I also checked out the equality operators in Python. Here's the list:

== Equal to
!= Not equal to
<> Not equal to
< Less than
> Greater than
<= Less than equal to
>= Greater than equal to

While looking at the page describing Python operators, I came across membership operators, which I found quite interested. Python has two membership operators which can work with sequences such as lists, tuples, and strings.

No comments:

Post a Comment