#Pointers in where to fix my code.

1 messages · Page 1 of 1 (latest)

violet rivet
#

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.

fickle igloo
#

lets goooo

#

post code

violet rivet
fickle igloo
#

In which line does the crash happen?

violet rivet
#

line 16

fickle igloo
#

how are you starting the program?

violet rivet
#

through command prompt

fickle igloo
#

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)?

violet rivet
#

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

fickle igloo
#

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?

violet rivet
#

sorry theres a better sc

fickle igloo
#

ayyyy we even got git in there nice

#

Try printing out sys.argv in line 12 or so as well

violet rivet
#

ill try that

reef finch