KnowledgeBoat Logo
|

Computer Science

Consider the following code segment:

a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))
if a <= 0:
   b = b +1
else:
   a = a + 1
if a > 0 and b > 0: 
   print ("W") 
elif a > 0:
   print("X") 
if b > 0:
   print("Y") 
else:
   print("Z")

What letters will be printed if the user enters 1 for a and -1 for b?

  1. W and X
  2. X and Y
  3. Y and Z
  4. X and Z
  5. W and Z

Python Control Flow

6 Likes

Answer

X and Z

Answered By

2 Likes


Related Questions