nerdexam
GIAC

GPYC · Question #32

Review the following code: a = "123" b = "456" if ("1" in a) ^ ("4" in b): print("red") elif ("2" in a): print("blue") elif ("7" in b): print("yellow") What is the output of this code?

The correct answer is A. blue. You've hit your limit · resets 1pm (America/New_York)

Python Fundamentals & Command Line Tools

Question

Review the following code: a = "123" b = "456" if ("1" in a) ^ ("4" in b): print("red") elif ("2" in a): print("blue") elif ("7" in b): print("yellow") What is the output of this code?

Options

  • Ablue
  • Bred blue
  • Cred blue yellow
  • Dred

How the community answered

(34 responses)
  • A
    76% (26)
  • B
    6% (2)
  • C
    3% (1)
  • D
    15% (5)

Explanation

You've hit your limit · resets 1pm (America/New_York)

Topics

#XOR operator#boolean logic#conditional statements#string membership

Community Discussion

No community discussion yet for this question.

Full GPYC Practice