Python Forum

Full Version: Do not know how to add "Code Tags" or "Error Tags" to my submissions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is this how you add tags to code and error messages?

def main():
    print ("Guess a number between 1 and 100.")
    randomNumber = 35
    found = False       # flag variable to see
                        # if they've guessed it
    while not found:
        userGuess = input("Your guess: ")
        if userGuess == randomNumber:
            print ("You got it!")
            found = True
        elif userGuess > randomNumber:
            print ("Guess lower!")
        else:
            print ("Guess higher!")

main()
Error:
Traceback (most recent call last):   File "/Users/Matthew/Documents/new.py", line 19, in <module>     main()   File "/Users/Matthew/Documents/new.py", line 14, in main     elif userGuess > randomNumber: TypeError: '>' not supported between instances of 'str' and 'int'
If I am not adding code tags or error tags properly please let me know. 

Thanks.
Well done Matt, this is exactly it.
moved to board forum

Yup that is it. Its just a way to format HTML but restrict users in what they can format. All the other tags are similar as well.