I have a different challenge with this custom container. I have followed Mosh examples on it, yet I still have syntax error on the__setitem__ magic method. I don’t know why the return statement gives syntax error at the position of ‘= count’
Please, someone may look at my code and help me out.
The single equals sign (
=) is the assignment operator and does not “return” anything:
count = 2 # count is being set equal to 2
There is also the double equals sign (
==) which is the equality operator that returns a boolean:
count == 2 # True if count is equal to 2
If you just intend the assignment (as a side effect of the call) you can just remove the
@jmrunkle: Thanks a lot, removing the ‘return’ keyword works and gets me the output I want. I am grateful for your help.