Argv – String into Integer

sys.argv is indeed a list of strings. Use the int() function to turn a string to a number, provided the string can be converted. You need to assign the result, however: num1 = int(argv[1]) num2 = int(argv[2]) or simply use: num1, num2 = int(num1), int(num2) You did call int() but ignored the return value.

argv[argc] ==?

From the Standard: 5.1.2.2.1 Program startup … — argv[argc] shall be a null pointer. So, yes; argv is null terminated

When can argv[0] have null?

With the exec class of calls, you specify the program name and program executable separately so you can set it to NULL then. But that quote is actually from the ISO standard (possibly paraphrased) and that standard covers a awfully large range of execution environments from the smallest micro-controller to the latest z10 Enterprise-class mainframe. … Read more