Light Mode
Dark Mode
boolean algebra

why i cant solve this: https://py.checkio.org/mission/boolean-algebra/

with my code

def boolean(x, y, operation):
if operation is "conjunction":
    return 1 if x == 1 and y == 1 else 0

if operation is "disjunction":
    return 0 if x == 0 and y == 0 else 1

if operation is "implication":
    return 0 if x == 1 and y == 0 else 1

if operation is "exclusive":
    return 0 if (x == 1 and y == 1) or (x == 0 and y == 0) else 1

if operation is "equivalence":
    return 1 if (x == 1 and y == 1) or (x == 0 and y == 0) else 0

checker send me message: Your result:None Right result:0 Fail:boolean(0,0,"conjunction")

  • bug
  • code_review
  • python
Created: June 12, 2019, 6:23 p.m.
Updated: June 12, 2019, 11:44 p.m.
0
8
User avatar
iliarkhpv