Hello, all. I will be transparent and explain that this is for an assignment, however I am looking for potential reasons as to why my code is not giving the correct output when using except/if/elseif in my code. I am a beginner, and my code inputs everything correctly except for an error i get when attempting to input a string rather than integer for my code. Per instruction I am supposed to have an error message when it is not a numeric value, but instead I keep receiving "invalid literal for int() with base 10". Any information i've looked has yielded little result, so some pointers in the right direction would be great.
#Pointers in where to fix my code.
1 messages · Page 1 of 1 (latest)
In which line does the crash happen?
line 16
how are you starting the program?
through command prompt
I mean basically it's telling you that one of the strings you're trying to convert isn't a valid number
Might be that you're passing decimals (aka float)?
theyre all integers, but when trying to get the error when it's not a number (i.e using a word) it offers the str error
Can you post the exact command you're using to run the script here?
Also your screenshot doesn't have line numbers, I assume line 16 is the first num1 = ... in the first try block?
sorry theres a better sc
ayyyy we even got git in there nice
Try printing out sys.argv in line 12 or so as well
ill try that
But no syntax highlighting haha