Skip to content
← Back to Community
Weird bug happening
Profile icon
YuvanVighnesh

A few of you might have seen my calculator. Recently I have seen that whenever you input a number greater than or equal to 4, the program terminates itself. Any ideas?
https://repl.it/join/wqxjlkzq-yuvanvighnesh

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
fnemaz
Profile icon
YuvanVighnesh
Comments
hotnewtop
Profile icon
Coder100

Line 31-34:

a=int(input("Enter the desired number here")) if a > 11: print("Enter a valid number") sys.exit()

you forgot indentation for sys.exit() xD

Correct code:

a = int(input("Enter the desired number here")) if a > 11: print("Enter a valid number") sys.exit()

Also, why is your indentation so weird? Why are you not indenting by 2 or 4 spaces? smh

Profile icon
YuvanVighnesh

wdym for me its showing 2 [email protected]

Profile icon
Coder100

hm? well anyways did it work @YuvanVighnesh

Profile icon
YuvanVighnesh

unfortunately, [email protected]

Profile icon
Coder100
Profile icon
Coder100

Oh, also on line 127 @YuvanVighnesh

Profile icon
Coder100
Profile icon
CodeLongAndPros

Try changing sys.exit()() (Line 103) to sys.exit()

Profile icon
YuvanVighnesh

still doesn't [email protected]