Help needed, guys!


#1

So, I was trying to cover all possibilities and I thought it is the shortest method to do it. However, when I press space, then press Run, it gives me “No numbers, please” but it is meant to write “Empty space”.

print ‘Welcome to the Pig Latin Translator!’

original = raw_input(“Enter a word:”)

if len(original) > 0 and original.isalpha():
print original
elif len(original) == 0 and original.isalpha():
print "Empty space"
else:
print “No numbers, please”

P.S. now I see how coding is quite intellectual…


#2

An empty space is still a character so has length. An empty string has no characters, not even spaces, so, ""

A string with zero length cannot be isalpha().

Check the instructions and set aside improvisation until after you pass the lesson.


#3

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