Computer Science, asked by anamtakhan3434, 4 months ago


5. Write a function in Python PUSH() to insert an element in the stack. After inserting the element display
the stack

Answers

Answered by jai696
11

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def PUSH(item, stack):

stack += [item]

return stack

stack = []

for item in ["onions", "carrots", "peppers"]:

print(PUSH(item, stack))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions