Q. Predict the output of the following code snippet?
(a)
arr = [1, 2, 3, 4, 5, 6]
for i in range(1, 6) :
arr [i - 1] = arr [i]
for i in range(0, 6) :
print(arr [ i ], end = " ")
(b)
Numbers = [ 9, 18, 27, 36 ]
for Num in Numbers :
for N in range (1,Num%8) :
print (N, "#", end = " ")
print ()
Answer =
(a)
2 3 4 5 6 6
(b)
1 #
1 # 2 #
1 # 2 # 3 #
>>>
you have writen wrong question pls correct it
ReplyDeleteQ 4 (b) Numbers = [ 9, 18, 27, 36 ]
for Num in Numbers :
for N in range (1,Num%8) :
print (N, "#", end = " ")
print ()
Hii dear, pathwalla's question is correct
DeleteCheck in book...
DeleteIg Path walla is correct cuz they solved the same question as the one given in book..
DeleteANS will be
ReplyDelete1 #
1 # 2 #
1 # 2 # 3 #
I too thought of the same thing
DeleteWhich part
Deleteanswer will be
ReplyDelete-
1 #
1 # 2 #
1 # 2 # 3 #
Which part
DeleteIn first snippet of code, where does the element 1 go, if all elements shift to left, and also how come 6 is printed twice?
ReplyDeletePlease copy the program then run in your idle python. Then try to understand by using print statement.
DeleteSir, plzz start u'r u tube channel soon... It's my humble request...
ReplyDeleteWhy?
Deletehello
ReplyDeleteYes..
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )