Stacks Syntax Error

I am currently learning about stacks and I keep getting a SyntaxError: for class What am I doing wrong?

Your’re trying to run a Java source code with a Python interpreter.

I completed the python mastery class but have never worked with java. How do I change it to run java or do I need to use a different program besides pycharm?

To develop Java programs you need at least the Java Development Kit (JDK) and an editor or IDE (e.g. IntelliJ IDEA).

But if you have some experience with Python you could as well use Python for the course translating the code shown to Python since the course does not focus on a language but on data structures and algorithms.

I’m not sure if Python has something like generics (<Integer> in your example) but that shouldn’t matter for the algorithms.