Python Forum
Do not know how to add "Code Tags" or "Error Tags" to my submissions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Do not know how to add "Code Tags" or "Error Tags" to my submissions
#1
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.
Reply


Messages In This Thread
Do not know how to add "Code Tags" or "Error Tags" to my submissions - by mattkrebs - Mar-21-2017, 01:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BBCode tags NLittle17 5 4,221 Jan-07-2019, 11:02 PM
Last Post: Larz60+
  People Not Using Code Tags micseydel 16 8,215 Dec-09-2017, 06:49 AM
Last Post: micseydel
  Just a trial. For learning code tags sylas 3 3,701 Sep-25-2017, 11:41 AM
Last Post: metulburr
  Weird Python tags syntax coloring bug micseydel 4 4,415 Jun-02-2017, 05:04 AM
Last Post: nilamo
  note moderator instead of mod tags metulburr 7 5,472 Apr-11-2017, 01:05 PM
Last Post: metulburr
  Please use code tags Larz60+ 28 15,769 Apr-06-2017, 09:47 PM
Last Post: metulburr
  Created a plugin for our code tags stranac 18 13,645 Dec-13-2016, 12:16 PM
Last Post: Kebap
  a few extra tags metulburr 2 4,614 Oct-05-2016, 09:22 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020