PygLatin Check Youself


#1

print 'Welcome to the Pig Latin Translator!'

Start coding here!

original = raw_input('Whats your name or should I say, hatsway ouryay amenay?')
if original < 0:
print original
else:
print"empty"

what is wrong with this? What Im trying to do is get it to print what I typed into raw_input. It always print empty after i type something and press enter and doesnt print what the user entered in. Help?


#2

Nvm I fixed it........................


#3

How? I've been having the same problem.


#4

The sign is backwards


#5

What sign? I do not understand this either


#6

See the greater than sign after if original? Its backwards xD. If original was less than zero (negative numbers) than it would work. Otherwise it will not work unless it is Greater than zero.


#7

Yeah. I got it now. Thanks


#8

make sure that your code looks like this
original=raw_input("Enter a word:")
if len(original)>0:
print "original"
else:
print "empty"


#9

print 'Welcome to the Pig Latin Translator!'

Start coding here!

raw_input("Enter a word:")
original = raw_input()
if len(original)>0:
print "original"
else:
print "empty"

Can someone plz help me with whats wrong with this


#10

raw_input("Enter a word:")
original = raw_input()
if len(original)>0:
print "original"
else:
print "empty"

You need to remove the quotation marks from original. So:

raw_input("Enter a word:")
original = raw_input()
if len(original)>0:
print original
else:
print "empty"


#11

I actually tried to define something at the start and had an error due to a random space (with half done code) and the site considered the program complete and moved me on to the next one. Shouldn't it at least check if the raw_input was printed correctly in pyglatin?

I also originally read the task as confirming if the string is indeed a number and using a loop until a proper word is entered mostly due to this - Make sure the user entered a valid word. though it seems in this thread that they only want to make sure you don't enter nothing.

I also don't quite remember being taught english_word[1:] in order to remove the first letter but it might just be me being forgetful.

Edit:

Oh, nevermind, I'm an idiot. I was at Pyglatin - Break It Down and I assumed I already had to write the code for it there (which I sorta did). My bad. On with the lesson. :C

"""
This is a program that will translate a word into pig latin.
"""
en_word = "English"
print "This program will translate an English word into Pyglatin."
en_word = raw_input("Please enter a valid English word: ")
if len(en_word) > 0:
print "Removing the first letter of the word."
en_first_letter = en_word[0]
en_word = en_word[1:]
print en_word
print "Moving the first letter of the word to the end and adding -ay."
print en_word + en_first_letter.lower() + "ay"
else:
print "You did not enter a valid word."


#12

Ive tried this exact code but somehow it gives me this error:
Oops, try again. Oops! Did you accidentally delete the variable called original?

Help please?


#13

Hi can you post your code?


#14

Try original = raw_input("Enter a word:") instead of the first two lines.


#15

why wont this work it is reall annoying


#17

original = raw_input("Enter a word;")
if len(original)>0:
print original
else:
print "empty"

I have a error at "if" statement
why? how?


#18

@netwhiz50258

where you put original in brackets, it should have (empty_string) . Also, before the if statement you should have:

empty_string = " "


#19

@102696
@wizmarco
@aroiisu

This was my code that works fine on me.
Always remember that python matters with its indention.
Try to indent your code using tabs or space.
I just indented 'print' keyword in 2 spacing.

original = raw_input("Enter a word:")

if len(original) > 0:
print original
else:
print "empty"


#20

Buddy, I have to say you make a mistake.I know that because i also make that mistake.

raw_input('Enter a word:')
original = raw_input()
if original>0:
print original
else:
print 'empty'


#21

Sorry about that.I think it's just me who make a mistake.I fixed it after i typed those words.