enthought - quit() function not working in Canopy, but works using terminal -


i'm learning python online @ moment , using (macos) canopy install of python. lesson how use quit() function try except. error in canopy:

---> 11     quit()      13 print 'your number is:', number nameerror: name 'quit' not defined 

----------------- here code:

try:     inpt = raw_input('enter number: ')     number = float(inpt) except:     print 'error, please enter numeric number'     quit() print 'your number is:', number 

all code print out number if put in that's not number, says 'error, please enter numeric number', instead of throwing error.

same code works fine using terminal. i'm wondering, should using canopy or missing something?

thanks

canopy's python shell ipython's qtconsole. ipython has taken scientific python world storm in recent years power , convenience, , in respects proper superset of standard python, few of small convenience changes can confusing beginners. quit 1 of small changes. (a more commonly confusing 1 described @ https://support.enthought.com/entries/25750190-modules-are-already-available-in-the-pylab-python-prompt-but-not-in-a-script).

for exercise, suggest replacing quit() equivalent import sys;sys.exit()


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -