[PyAR2] .upper()

Daniel Veazey daniel at danielveazey.com
Sat Aug 6 14:40:17 CEST 2011


Almost a total noob here, getting stumped. Using Python 2.7.1+. Here is my
code:

while True:
    reply = input("Enter text: ")
    if reply == 'stop': break
    print(reply.upper())

It's supposed to just take the text that the user has entered and print it
in uppercase, unless the user types 'stop.'

But I get errors when I run it:

Enter text: word
Traceback (most recent call last):
  File "upper.py", line 2, in <module>
    reply = input("Enter text: ")
  File "<string>", line 1, in <module>
NameError: name 'word' is not defined

Enter text: stop
Traceback (most recent call last):
  File "upper.py", line 2, in <module>
    reply = input("Enter text: ")
  File "<string>", line 1, in <module>
NameError: name 'stop' is not defined

Enter text: two words
Traceback (most recent call last):
  File "upper.py", line 2, in <module>
    reply = input("Enter text: ")
  File "<string>", line 1
    two words
            ^
SyntaxError: unexpected EOF while parsing

Any tips?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/pyar2/attachments/20110806/1dd50344/attachment.html>


More information about the PyAR2 mailing list