Python NoneType object is not callable (beginner)

前端 未结 4 1736
傲寒
傲寒 2020-12-04 14:25

It tells me line 1 and line 5 (new to debugging/programming, not sure if that helps)

def hi():
    print(\'hi\')


def         


        
4条回答
  •  -上瘾入骨i
    2020-12-04 15:06

    You should not pass the call function hi() to the loop() function, This will give the result.

    def hi():     
      print('hi')
    
    def loop(f, n):         #f repeats n times
      if n<=0:
        return
      else:
        f()             
        loop(f, n-1)    
    
    loop(hi, 5)            # Do not use hi() function inside loop() function
    

提交回复
热议问题