8/11 can some1 help me


pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) and original.isalpha():
word = original.lower()
first = word [0]
print original
print word
print “empty”

Thats my code, and every time i write something, and enter, it goes on “empty” could some1 tell me where i fail


the if statement needs to be true that the length of original is greater than empy and also has alpahbetic chars, although thats probably a laymen explanation! so as previous lesson showed:

if len(original) > 0 and original.isalpha():

you are saying that if len(original) and original.isalpha(): do what is in the if statement, else print empty. Also dont use non alphabetical characters :slight_smile:

hope that makes sense.


thx, for replying, but could u be a bit more like “graphical” like what do u mean with “non alphabetical characters” ?


Now that the new value, word is adapted from original we no longer need that variable, or its output. Leave the other line until you get the code working, then eventually it will be replaced with new_word once you finish building it.


will reject all characters that are not actual letters in the 26 letter alphabet (either case). That includes spaces so only a single word may be entered.


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