Home > database >  Why is Python giving me an error in the code
Why is Python giving me an error in the code

Time:10-13

def input(self,key):
    if self.hovered:
        if key == 'left mouse down':
            voxel = Voxel(position = self.position  mouse.normal)

I get this error:

TypeError: input() missing 1 required positional argument: 'key'

Why is it showing this error?

CodePudding user response:

Input is a keyword, you cannot use it to define your own function. There is also indentation error in if statement. While calling it after changing everything, give two parameters while calling

CodePudding user response:

Your question will become more clear if you share your function call also. Here, you are using a built-in method in Python input which is used for taking an input value from user through terminal. For example,

username = input("Please enter Username: ")

You can try a different name for your function. I hope it will work like a charm !!!

  • Related