Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82514

How to use the .isalpha() function correctly

Newsgroups comp.lang.python
Date 2014-12-14 09:16 -0800
Message-ID <3abc022a-2916-4bfb-b722-20037a646045@googlegroups.com> (permalink)
Subject How to use the .isalpha() function correctly
From Luke Tomaneng <luketomaneng@gmail.com>

Show all headers | View raw


Here a very small program that I wrote for Codecademy. When I finished, Codecademy acted like it was correct, but testing of this code revealed otherwise.
--------------------------------------------------
print 'Welcome to the Pig Latin Translator!'

# Start coding here!
raw_input("Enter a word:")
original = str(raw_input)
if len(original) > 0 and original.isalpha():
    print original
else:
    print "empty"
--------------------------------------------------
No matter what I type in, the result is "empty." What do I need to do in order for it to accept words?

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How to use the .isalpha() function correctly Luke Tomaneng <luketomaneng@gmail.com> - 2014-12-14 09:16 -0800
  Re: How to use the .isalpha() function correctly Chris Warrick <kwpolska@gmail.com> - 2014-12-14 18:26 +0100
    Re: How to use the .isalpha() function correctly Luke Tomaneng <luketomaneng@gmail.com> - 2014-12-14 09:29 -0800

csiph-web