Advertisements
Advertisements
प्रश्न
Here is the code for the pop method in the stack to print a string in reverse order. But there is some missing word. Answer the question that follows to execute the code successfully.
def popstack (stack)__ # Line 1
if isempty (stack): # Line 2
___ # Line 3
___: #Line 4
top = len(stack) __ # Line 5
for a in range (top, -1, -1):
print stack__, # Line 7
return
Which value will be used in line 7?
पर्याय
(A)
[a]
<a>
{a}
MCQ
Advertisements
उत्तर
[a]
Explanation:
The index position of the list item is represented by [a]. The assertion Print stack[a] will print the stack item starting at index point [a], where a can range from the last index position to 0 to reverse the text.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
