class CircularlyLinkedList:
def __init__(self):
self.tail = None
self.size = 0
.
.
When I ran the above code and entered:
ls1 = CirculralyLinkedList()
An error occurred: An expression must come after ‘(‘.
This error did not occur when running with IDLE.
If I need to type something after ‘(‘, please tell me what to type.
2
Answers
This code seems to be working fine on my device. Please check if there are other issues showing up in your IDE.
If this doesn’t do it, try adding a pass statement at the end of the constructor. Like so,
I mentioned adding a pass statement because I saw a parser error in the image attached. In Python, the pass statement is basically a null operation, so nothing happens when it executes. It’s used as a placeholder when the syntax requires a statement, but no action is really needed in that case.
You enter python code directly in the cmd terminal, which is not recognized. You need to enter pythonREPL.
You could try the following ways:
ls1 = CirculralyLinkedList()
to cell2. This way you can achieve the same goal when you execute cells sequentially