How can i fix my variable in function
I'm confused on why my "tries" can't plus 1 in my code . can anyone help me with my code? Here's the code I wrote : import random number = random.randint(1,100) print("Here's the question\nI'm looking for a number from 1 to 100 ") guess_num = input("Enter a number :") def guessing_func(guess_num): tries = 1 if guess_num < number : print("guess higher ") guess_num = input("Try again :") return guessing_func(guess_num) tries += 1 elif guess_num > number : print("guess lower ") guess_num = input("Try again :") return guessing_func(guess_num) tries += 1 elif guess_num == number : print("You got it ,the number is {0} . \nYou have tried {1} times".format(number , tries )) guessing_func(guess_num)