4. Check yourself! Pyg Latin


#1

my code doesnt work:

print 'Welcome to the Pig Latin Translator!'

# Start coding here!

original=raw_input("Enter a word: ")

size=len(original)

if size>0:
  print original

  else: print "empty"

the error says:

File “python”, line 14
else: print “empty”
^
SyntaxError: invalid syntax


#2

You nested else inside the if clause, why?

the else should be after if clause, given you want to run it when if condition evaluates to false


#3

oh…thank you alot man…can i give u points or something for helping?


#4

you can check here:

https://discuss.codecademy.com/c/new-users

which has a topic:

Quick Tips for Using Forums

which can be useful as you are new to forum, as well as the guidelines

as for the points, no you can’t. You can give likes, to show you liked an answer and found it helpful


#5

And giving your first like also gives you a badge :slight_smile:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.