Jumia

Saturday, December 2, 2017

Python programming

                                           Boolean Expressions

>>>'a' == ('a' or 'b') # Look at parentheses first, so evaluate expression "('a' or 'b')" # 'a' is a nonempty string, so the first value is True # Return that first value: 'a' >>>'a' == 'a' # the string 'a' is equivalent to the string 'a', so expression is True Second case: >>>'b' == ('a' or 'b') # Look at parentheses first, so evaluate expression "('a' or 'b')" # 'a' is a nonempty string, so the first value is True # Return that first value: 'a' >>>'b' == 'a' # the string 'b' is not equivalent to the string 'a', so expression is False False Third case Fourth case: >>>'b' == ('a' and 'b') # Look at parentheses first, so evaluate expression "('a' and 'b')" # 'a' is a nonempty string, so the first value is True, examine second value # 'b' is a nonempty string, so second value is True # Return that second value as result of whole expression: 'b' >>>'b' == 'b' # the string 'b' is equivalent to the string 'b', so expression is True True

No comments:

It’s Official! Buhari Wins 2019 Election

President Muhammadu Buhari has won the 2019 presidential election, polling 15,191,847 votes  to defeat his closest rival, Alhaji Atiku ...

Popular Posts