The source of the error is on line 3 script, first, second, third = argv
. argv is a way of seeing what extra information is being given to your program. When you call your program with python section12.py
, argv is defined as ("section12.py",)
. When you call your program with python section12.py 65
, argv is defined as ("section12.py", "65")
. When you say script, first, second, third = argv
, you are assigning a name to each item of argv. If you call your program with just python section12.py
, argv has only one item, but you are trying to assign four variables to it. The error is that it doesn’t have enough items to assign to those variables. To fix it, try calling your program with something like this: python section12.py myfirst mysecond mythird
. Fiddle around with it; have fun!
9
solved Exercise 13: Parameters, Unpacking, Variables – Totally lost