[Tutor] new guy problem, what's wrong with this program.

bill.wu bill.wws at gmail.com
Mon Jan 14 05:08:13 CET 2008



mumber = 23
running = Ture
while running:
    guess = int(raw_input('Enter an integer :'))
    
    if guess == number:
        print 'congratulations, you guessed it.'
        running = False
    elif guess < number:
        print 'no, it is a little higher than that'
    else:
        print 'no, it is a little lower than that'
else:
    print 'the while loop is over.'
print 'done'


when i run it, interactive window show:

Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 307, in RunScript
    debugger.run(codeObject, __main__.__dict__, start_stepping=0)
  File "C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run
    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File "C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 631, in run
    exec cmd in globals, locals
  File "C:\Documents and Settings\asus\桌面\while.py", line 2, in <module>
    running = Ture
NameError: name 'Ture' is not defined



how to solve. thanks 

____________________________________________________________________
DreamMail - 第一次不用是你的错,第二次不用是我的错 www.dreammail.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080114/d6892bc1/attachment.htm 


More information about the Tutor mailing list