Answered You can hire a professional tutor to get the answer.

QUESTION

Question: I do not know what is wrong with my code because the output from cnf and def should be exactly the same. The 2 table should say the same...

Question:I do not know what is wrong with my code because the output from cnf and def should be exactly the same. The 2 table should say the same 

thing. However, both table state only half of it is correct in the results in diff parts of the table. Cnf states the first 8 lines is correct in the table. Def states the last 8 is correct. However, they are both opposite to each other. I do not know how to fix my code so that both results combine with cnf top half and the dnf bottom half. 

the table

A  B  C  D  f

T  T  T  T  T

T  T  T  F  F

T  T  F  T  F

T  T  F  F  F

T  F  T  T  T

T  F  T  F  T

T  F  F  T  T

T  F  F  F  T

F  T  T  T  T

F  T  T  F  F

F  T  F  T  F

F  T  F  F  T

F  F  T  T  F

F  F  T  F  F

F  F  F  T  F

F  F  F  F  T

the code I made :

def cnf(a, b, c, d):

  return [

    [a, b, c, d], #t

    [not a, not b, not c, d], #

    [not a, not b, c, not d], #

    [not a,not b, c, d], # f

    [a, not b, c, d],  # T

    [a, not b, c, not d], #t  

    [a, not b, not c, d], #t

    [a, not b, not c, not d],#

  ]

def dnf(a, b, c, d):

  return [

    [not a, b, c, d], # T

    [ a, not b, not c, d], # F

    [a, not b , c, not d], # F

    [ not a, b , not c, not d], # t

    [a, b, not c, not d], #f

    [ a, b , not c, d], 

    [a, b , c, not d], 

    [not a, not b , not c, not d], #

  ]

results:

cnf output: 

A | B | C | D | f |

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question