CJCoding With Joseph
15free / daySign inCreate account

Pile Pop And Size

Write the whole Pile class. The constructor takes no arguments and creates an empty list attribute items; push(value) adds a whole number to the end with .append(); pop() removes the last value with .pop() and returns it; size() returns how many values remain. 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 push in order; they then print the size, the value pop returns, and the size again, each on its own line.

Expected Output:

3
15
2

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

Hints3 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.