Error:Piece() Takes No Argument

I followed a guide that my instructor gave us to make any type of game. I decided to make Tetris. I decided to use this line of code to return a random shape that I stated at the top of the code.
def get_shape():
global shapes, shape_colors

return Piece(5, 0, random.choice(shapes))

For whatever reason it returns with a Takes No Argument error.

So this sort of error is usually raised when you are trying so pass arguments to things which don’t take arguments. It is hard to say what is causing this for you given the code snippet provided, but here is a simple example which should raise a similar error:

def func():
    return True


Because the function func doesn’t take any arguments, it raises an error when you try to pass it 10.

Try and look back at your code and see if the offending object takes arguments. Note, if Piece is a class then the arguments are passed to the __init__ method.

Good luck with your game :slight_smile: