Q. What will be the output produced by following code fragment (s)?


(i)

X = 10

X = X + 10

X = X - 5

print (X)

X, Y = X- 2, 22

print (X, Y)


(ii)

first = 2

second = 3

third = first + second

print (first, second, third)

first = first + second + third

third = second * first

print (first, second, third)


(iii)

side = int(input('side')) #side given as 7

area = side * side

print (side, area)



Answer =

(i)
15
13 22

(ii)
2 3 5
10 3 30

(iii)
side7
7 49

12 Comments

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

  1. I think (ii) answer is wrong maybe it should be 2 3 6
    11 3 33

    ReplyDelete
    Replies
    1. You are wrong. Just copy it and paste in your idle python software. And then run it.

      Delete
    2. Question has changed no one is wrong instead of + they turned question into *

      Delete
  2. Yeah both are correct. For book answer is
    2,3,6
    11,3,33

    ReplyDelete
    Replies
    1. Please send me that question.

      Delete
    2. I think answer no. 2 is wrong
      The answer is 2,36
      11,3,33

      Delete
    3. How it is 11,3,33 can u tell me

      Delete
  3. in a book * and in your q.+ symbol

    ReplyDelete
  4. in last code how we can go to second line without pressing enter. cause if i press enter it straight show outcome.

    ReplyDelete
  5. Bro in second part ... You accidently put third = first+second..
    In book it is third= first*second

    ReplyDelete

Post a Comment

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

Previous Post Next Post