How can I run a function?

I want to run the xa function, but there is an error. The error is: Bad input(last line) what can I do? The context doesnt matter, its bad input error. Its written in Python

def xa(y):
  x = 2 + y


xa(22)

thanks

2 answers

  • answered 2021-04-21 12:02 KJDII

    Missing an indent after the if statement or incomplete code?

    
    def xa(y):
      x = 2 + y
    
    if zahl1 == int:
      xa(22)
    
    

    or

    
    def xa(y):
      x = 2 + y
    
    if zahl1 == int:
      pass
    
    xa(22)
    
    

  • answered 2021-04-21 12:02 Ann Zen

    You'll need to change

    if zahl1 == int: 
    

    to

    if isinstance(zahl1, int):
    

    or

    if type(zahl1) == int:
    

    See the documentation for isinstance and type for more information.