5. Check Yourself - Some more


#1

print 'Welcome to the Pig Latin Translator!'

original = raw_input("What's your name")

print "%s" % (original)

alphabet = "4B1F8"
if len("alphabet") < 7 and alphabet.isalpha(): 
    print "alphabet.isalpha()"
else :
    print "You made a wrong"

and as a result, "You made a wrong" on window? What is my wrong there?


#2

len("alphabet") returns 8 so len("alphabet") < 7 is false...
May be you want to say if len(alphabet) < 7

also "4B1F8" is not alpha


#3

How? Can not everything be an alpha?


#4

4,1 and 8 are numbers not apha... so "4B1F8" is alphanumeric not alpha. That's why alphabet.isalpha() returns false..


#5

Is there anyone available to help me with this problem im lost and dont know where to start


#6

But still I have a wrong.

print 'Welcome to the Pig Latin Translator!'

original = raw_input("What's your name")

print "%s" % (original)

solve = "FBFA"
if len(solve) > 0 and solve.isalpha()  :
    print "at this end"
else :
    print "empty"

#7

alphabet.isalpha() returns a false as alphabet clearly contains numbers too. So the and statement returns False.


#8

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