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
I think (ii) answer is wrong maybe it should be 2 3 6
ReplyDelete11 3 33
You are wrong. Just copy it and paste in your idle python software. And then run it.
DeleteYeah both are correct. For book answer is
ReplyDelete2,3,6
11,3,33
Please send me that question.
DeleteI think answer no. 2 is wrong
DeleteThe answer is 2,36
11,3,33
How it is 11,3,33 can u tell me
Deletein a book * and in your q.+ symbol
ReplyDeleteWhere.
Deletein last code how we can go to second line without pressing enter. cause if i press enter it straight show outcome.
ReplyDeleteIt is obvious.
DeleteBro in second part ... You accidently put third = first+second..
ReplyDeleteIn book it is third= first*second
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )