Thread: Help!

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Help!


    I am new to python and need some help i created a program that translates English to Piglatin in a class and added a nested loop, so that it will continue the program until you tell it no, but it still isnt working
    python Code:
     
    #pig latin thingy made by taylor
    print "Welcome to the English to Pig Latin translator! The only one ever needed because your dumb!"
    #variables
    pant == "no"
    while pant == "yes":
        original = raw_input("Enter an English word you Grabbler:")
        pyg = 'ay'
        word = original.lower()
    #Check to see if word contains a vowel
        if len(word) == 0:
            print "its empty you dumb ****!"
        elif word.isalpha() == False:
            print "No numbers either asshat!"
        else:
            print "Congrats you typed a word you ****! \n Here is the word in pig latin:"  
    #declare remainder of variables
            char = len(word)
            vFirst = word + pyg
            cFirst = word[1:char]+first+pyg
            first = word[0]
    #making sure first letter is not a vowel and printing results
            if word[0] == "a" and "e" and "i" and "u" and "o":
                print vFirst
            else:
                    print cFirst
        pant = (raw_input("Type something, and press Enter, and the program will end"))# your code goes here
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,664
    Rep Power
    1958
    You set pant to no, but the loop is only started if pant is yes.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0
    Originally Posted by MrFujin
    You set pant to no, but the loop is only started if pant is yes.
    duh lol
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    still getting crap


    Code:
    #pig latin thingy made by taylor
    print "Welcome to the English to Pig Latin translator! The only one ever needed because your dumb!"
    #variables
    pant == "yes"
    while pant == "yes":
        original = raw_input("Enter an English word you Grabbler:")
        pyg = 'ay'
        word = original.lower()
    #Check to see if word contains a vowel
        if len(word) == 0:
            print "its empty you dumb ****!"
        elif word.isalpha() == False:
            print "No numbers either asshat!"
        else:
            print "Congrats you typed a word you ****! \n Here is the word in pig latin:"  
    #declare remainder of variables
            char = len(word)
            vFirst = word + pyg
            cFirst = word[1:char]+first+pyg
            first = word[0]
    #making sure first letter is not a vowel and printing results
            if word[0] == "a" and "e" and "i" and "u" and "o":
                print vFirst
            else:
                    print cFirst
        pant = (raw_input("Type something, and press Enter, and the program will end"))
    I am get this error from the compiler still i do not understand how it isnt declared heres the error code

    Traceback (most recent call last):
    File "prog.py", line 4, in <module>
    NameError: name 'pant' is not defined
  8. #5
  9. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,901
    Rep Power
    481
    Code:
    #pig latin thingy made by taylor
    print "Welcome to the English to Pig Latin translator! The only one ever needed because your dumb!"
    #variables
    pant == "yes"
    while pant == "yes":
    The statement in the larger font is an equality test, not an assignment statement.

    =


    Same problem exists in first post. Solving this will advance you to the next error, which will also be solved by close reading.
    Last edited by b49P23TIvg; January 11th, 2014 at 04:56 PM.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo