guess = int(guess). Not clear about the usage of this statement
If we have already used
then why are we using,
guess = int(guess)
Digit is already an integer then why are we converting it
Python String isdigit() method is a built-in method used for string handling. The isdigit() method returns “True” if all characters in the string are digits, Otherwise, It returns “False”.
guess=int(guess) is used to convert the input (which is initially a string) into an integer.
When you use the input() function in Python, it captures user input as a string by default. However, since you're comparing the user's guess to the secret_number variable (which is an integer), you need to convert the user's input from a string to an integer using the int() function.