What gets printed?
x = 0
y = l
a = cmp(x,y)
if a < x:
print "a"
elif a = = x:
print "b"
else:
print "c"
Answers
Answered by
0
"b" (and any subsequent words) was ignored because we limit queries to 32 words.
Answered by
2
The output value is a
Explanation:
Python number method cmp() is used to returns the sign of the difference of two numbers.
- Syntax - cmp( x, y )
- Parameters x − This is a numeric expression, y − This also a numeric expression.
- Return Value - This method returns -1 if x < y, returns 0 if x == y and 1 if x > y
In the given code
- x = 0
- y = l
- a = cmp(x,y)
- a=cmp(0,1)
- a=-1
- So a < x (-1 < 0) condition becomes true print "a" statement will be executed.
- So the output value is a
Similar questions
Biology,
5 months ago
Chemistry,
5 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
Physics,
1 year ago