Q. Find the output of the following code:


(a)

x = 3

y = x + 2

x += y

print (x, y)


(b)

x = -2

y = 2

x += y

x -= y

print (x,y)


(c)

a = 5

b = 2*a

a += a + b

b *= a + b

print (a, b)


(d)

p = 10

q = 20

p *= q / 3

q += p + q*2

print (p, q)


(e)

p = 5 % 2

q = p ** 4

r = p//q

p += p + q + r

r += p + q + r

q -= p + q * r

print (p,q,r)


(f)

p = 21//5

q = p % 4

r = p * q

p += p + q - r

r *= p - q + r

q += p + q

print (p, q, r)


Answer :-

(a)
8 5
>>>

(b)
-2 2
>>>

(c)
20 300
>>>

(d)
66.66666666666667 126.66666666666667
>>>

(e)
4 -10 7
>>>

(f)
8 8 0
>>>

1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Question no 2 is different from the text else everything is very helpful

    Thank you🌹❤

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post