I am used to coding in C#, and am now trying to learn Python. If I tried (erroneously) to compare a string and an int in C# I would get an error message telling me that it is unable to compare the two types. I had the following code, and couldn't figure out why it was never going into the if statement (it was because I had forgotten to convert the "guess" input from a string to an int). Does Python not give warnings if an error of this type is made?
from random import randint # Generates a number from 1 through 10 inclusive random_number = randint(1, 10) print "Guess the number from 1-10" guesses_left = 3 # Start your game! while guesses_left > 0: guess = raw_input("Your Guess:") if guess == random_number: print "You win!" break else: guesses_left -= 1 else: print "You lose"