Plutonic Rainbows

Prompting, Unpacking and Variables

Remember that you need to call the script from the command line and then list the things you want to show.

So for instance, if the script is called ‘ex12.py’, then you would type ‘python ex12.py apples strawberries pears’.

The results will then be printed out as:

The script is called: ex12.py

Your first variable is: apples

Your second variable is: strawberries

Your third variable is: pears

Anyway, here is the script.

from sys import argv

script, first, second, third = argv

print "\n"

print "The script is called:", script
print "\n"
print "Your first variable is:", first
print "\n"
print "Your second variable is:", second
print "\n"
print "Your third variable is:", third

print "\n"