Ask Question
27 February, 10:44

Assign testResult with 1 if either geneticMarkerA is 1 or geneticMarkerB is 1. If geneticMarkerA and geneticMarkerB are both 1, then assign testResult with 0. If geneticMarkerA and geneticMarkerB are both 0, then assign testResult with 0. Ex: If geneticMarkerA is 1 and geneticMarkerB is 0, then testResult is assigned with 1. If geneticMarkerA is 1 and geneticMarkerB is 1, then testResult is assigned with 0.

+5
Answers (1)
  1. 27 February, 11:11
    0
    Following python statement will give the assignment to testResult as specified:

    if ((geneticMarkerA = = 1) or (geneticMarkerB = =1)):

    testResult = 1

    if ((geneticMarkerA = =1) and (geneticMarkerB = = 1)):

    testResult = 0

    if ((geneticMarkerA = = 0) and (geneticMarkerB = = 0)):

    testResult = 0

    Explanation:

    In above statements or and and operator are used to check the conditions of set of values present in variable geneticMarkerA and geneticMarkerB.

    Based on if the condition evaluate to true or false respective values to testResult varaible is assigned.

    Following is sample run for above statements:

    geneticMarkerA = 1

    geneticMarkerB = 0

    if ((geneticMarkerA = = 1) or (geneticMarkerB = =1)):

    testResult = 1

    if ((geneticMarkerA = =1) and (geneticMarkerB = = 1)):

    testResult = 0

    if ((geneticMarkerA = = 0) and (geneticMarkerB = = 0)):

    testResult = 0

    print (testResult)

    Output

    1
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assign testResult with 1 if either geneticMarkerA is 1 or geneticMarkerB is 1. If geneticMarkerA and geneticMarkerB are both 1, then assign ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers