CJCoding With Joseph
15free / daySign inCreate account

Push Onto The Pile

A Pile keeps its values in a list attribute called items, newest last. Write the body of push so it adds value to the end of that list with .append(). Do NOT write a main block or any top-level test code; the tests construct the class. Input: one line of whole numbers separated by spaces, which the tests read and push one at a time, left to right, before printing the whole items list.

Expected Output:

[4, 8, 15]

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Classes
📥 Auto-Input:
4 8 15\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.