def login(log = 1):
con = input(f"{na} are you Ready for the game Yes/NO ")
if ((con == "Yes")or(con == "yes")or(con == "y")or(con == "Y")):
print("\nwelcome to The Game") # first time it will return true but recursive function call itself then it will return none
return True
elif(log == 3):
print("retry after long time")
else:
print("Retry again")
log = log + 1
login(log)
flag = login()
print(flag)
expected output : flag = True
output : flag = None
So close, you are only missing a return statement on the recursive call, so that the return value from the time it succeeds makes it back out to the original call, I have show that here.
Let me know if you have any questions.
As pointed out in comments by @stephan, there is another question with some more explanation here: Why does my recursive function return None?