0
def greet(): print("hello") greet() greet()
The following program output is hello in 1000 times how its giving 1000 hello as i have called greet function only two times someone helpe me to understand this https://code.sololearn.com/c56QS4Oy48MA/?ref=app https://code.sololearn.com/c56QS4Oy48MA/?ref=app https://code.sololearn.com/c56QS4Oy48MA/?ref=app
2 Answers
+ 3
That is an infinite recursive call. You are calling the function greet() inside itself.
When you say greet() it will call the function and prints 'hello' but the next line is greet() again which again calls the same function and this goes on.
+ 4
Remove the space which is before the first greet()