Code still executes after “quit” or “exit”, Python, Spyder

20 views
Skip to first unread message

sigma369

unread,
Oct 14, 2019, 2:44:09 AM10/14/19
to spyder
I am using spyder 3.6

below is my code.

scrip still runs and give error even after quit command (if any of input value us not numerical). please help

# HW1 #hw2
x= input('enter hours\n')
try:
    x=float(x)
    y=input('enter rate\n')
    y=float(y)
except:
    print('please enter numnerical values')
    quit()

xx=float(0.00)
yy=float(0.00)
if x>40:
    xx=x-40
    x=40
    yy=1.5*y
print ('total pay is ',((x*y+xx*yy)))

Moktar Mannaa

unread,
Oct 14, 2019, 7:21:37 PM10/14/19
to spyder
This happened with me, too.

bcolsen

unread,
Oct 16, 2019, 5:49:27 PM10/16/19
to spyder
You should use sys.exit() in a script. quit() is only for the console. More here:

Reply all
Reply to author
Forward
0 new messages