In many programming languages, the Boolean values True and False are actually stored as the numerical values 1 and 0, respectively. In Python, for example, both 0 == False and 1 == True are True. Thus, despite appearances, we can add or subtract or multiply Boolean values! Furthermore, in many languages (including Python), anything that is not False (in other words, anything other than 0) is considered True for the purposes of conditionals. For example, in many programming languages, including Python, code like if 2 print "yes" else print "no" will print “yes.” Suppose that x and y are two Boolean variables in a programming language, like Python, where True and False are 1 and 0, respectively—that is, the values of x and y are both 0 or 1. Each of the following code snippets includes a conditional statement based on an arithmetic expression using x and y. For each, rewrite the given condition using the standard notation of propositional logic.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here