Pyglatin 4. Check yourself - how to write print?


#1

print 'Welcome to the Pig Latin Translator!'

Start coding here!

original = raw_input ("Enter a word:")

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


#2

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

This is what I did and it worked.


#3

@bitrockstar43061

It does say to define original = raw_input("Enter a word:") and then see if that is empty or not.

As @gpvlr45 has in his code.


#4

I don't understand why I have to put de () in print (original)

print 'Welcome to the Pig Latin Translator!'

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


#5

I tried that exactly and it didn't work. it said "invalid syntax, line 5"


#6

did you write everything in one line? If you did, you need to write each in separate line like how I did in my post.


#7

This worked for me:

print 'Welcome to the Pig Latin Translator!'

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

#8

But then your line with
empty_string = ""
has no use at all?


#9

becasue original is a variable, that has an assigned value, print(variable) <---this really means: print (word that user typed). and the word that user typed was stored as a variable named original, sooo Print(original) works :smiley: i hope this helps i tried to explain that the best i could :smiley:

"welcome to the pig latin translator!" is a string. strings on the other hand, (from what i understand) are pretty much straight forward. they arent assigned and special value or variable.


#10

@js_ thank you, for putting that out there, it really helped me pass the level! :)smile:


#11

my code was also the same but it gave always same problem
then i tried

original = raw_input("Enter a word:")
if len(original) > 0:
print original
else:
print "empty"
this way, pay attention on SPACE and than it worked.

viel spass


#12

print "Pig Latin"

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


#13

Thank you this was very helpful!


#16

My code says:
Oops, try again. Oops! Did you accidentally delete the variable called original? but it is all there!

print 'Welcome to the Pig Latin Translator!'

original = raw_input("What is your name?:")
if len(original) > 0:
print original
else
print "Empty"


#19

I did the below. Is this right? Especially the part in bold.

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"


#20

hey @medouxa

when i do that it says invalid syntax line 12,which is the line that says:

else:


#21

@micac

please help me if you can with my question above


#22

I had with the same problem because I used the space incorrectly in 'else'. Your reply helped me so much. :slight_smile:


#23

i have tried all of the above and nothing is working. I am also getting an( Oops try again! Did you create a variable called original?) error. Is anyone available to help?


#24

I've somehow figured it out, thanks.