Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: python error

  1. #1
    Join Date
    May 2011
    Beans
    49
    Distro
    Ubuntu 11.04 Natty Narwhal

    Question python error

    ok here the problem im learning python programing and im having an error in terminal sayng that error line 40 unexpected indent. here the code

    Code:
    Code:
    #this is a guessing game
    #im also gonna explain it to you doc with these comments that are blue 
    
    #only imports we will use are , random, those are the imports
    import random
    
    #this will tell the computer how many times u guessed doc
    guessestaken = 0
    
    #every print means what the computer says doc and input it what ur sayng
    print("Eeh whats up doc? tell me your name doc" )
    myname = input()
    
    #this doc will the numbers u can try to guess but only one is right
    number = random.randint(1, 20)
    print("Well" + myname + "im a thinking of a number between 1 and 20")
    
    #okay doc this says ur chances
    while guessestaken < 6:
        print("take a guess doc")
    
    #this says the guess u said
        guess = input()
        guess = int(guess)
    
    #this says how many gueses u taken
    guessestaken = guessestaken + 1
    
    if guess < number:
            print("your guess is wrong doc")
    
    if guess > number: 
            print("no doc still wrong")
    
    if guess == number:
            break 
    
    if guess == number:
        guessestaken = str(guessestaken)
            print("good job" + myname + "u guessed it in" + guessestaken + "guesses")
    
    if guess != number:
        number = str(number)
            print("no doc that ain it")
    Last edited by rpmp; July 30th, 2011 at 12:58 AM.
    Ubuntu kicking windows butt.

  2. #2
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,292
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: python error

    Please edit your message and wrap CODE tags around your code. Right now we can't see the indentation at all, so we obviously can't help you with your indentation problem.
    「明後日の夕方には帰ってるからね。」


  3. #3
    Join Date
    May 2011
    Beans
    49
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: python error

    how exactcly do u do that? cause i dont know.

    wait i did it.
    Last edited by rpmp; July 29th, 2011 at 11:51 PM.
    Ubuntu kicking windows butt.

  4. #4
    Join Date
    May 2006
    Beans
    1,787

    Re: python error

    Quote Originally Posted by rpmp View Post
    how exactcly do u do that? cause i dont know.

    wait i did it.
    Obviously not.

    You use the word CODE in brackets, or select the whole thing and press the # symbol at the tool bar at the top.

  5. #5
    Join Date
    May 2011
    Beans
    49
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: python error

    what do u mean? i dont know how to do this
    Ubuntu kicking windows butt.

  6. #6
    Join Date
    May 2006
    Beans
    1,787

    Re: python error

    Quote Originally Posted by rpmp View Post
    what do u mean? i dont know how to do this
    If you reply to this post with the Quote button, you will see how the CODE tags are used in the little example below.

    Code:
    // this is code
    a = b

  7. #7
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: python error

    To edit with code tags easily after posting you have to use the advanced button and then you get the full menu in the edit panel at the top. On the right side of edit panel is #. If you highlight with mouse the code, then click #, it will put code tags before & after the highlighted area. You may have to repaste your code as it may have already lost the spacing.

    I found in python if copying code from another place, I would often mess up the spacing. I often have to back space to previous line. Sometime error is not even on line shown but another above it.

    I use Geany, but had to turn off tabs to use spaces automatically in three places. One is normal edit, one was saved files & the third was under projects.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  8. #8
    Join Date
    May 2006
    Beans
    1,787

    Re: python error

    Quote Originally Posted by oldfred View Post
    To edit with code tags easily after posting you have to use the advanced button and then you get the full menu in the edit panel at the top. On the right side of edit panel is #.
    Where is that advanced button? It always looks like that for me.

  9. #9
    Join Date
    May 2006
    Beans
    1,787

    Re: python error

    Quote Originally Posted by Arndt View Post
    Where is that advanced button? It always looks like that for me.
    I see now that there is a choice in the user profile to show that tool bar or not. I don't remember if I turned that on, or it was like that from the start. But I still don't see an advanced button when I'm using the basic mode.

  10. #10
    Join Date
    May 2011
    Beans
    49
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: python error

    ok finally did it thanks
    Ubuntu kicking windows butt.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •