Back around 1960, the hot language was FORTRAN. A lot of the work in this language was done using scalar variables, that is, a set of variable names, each of which held one number.
Suppose we've just had a snail race, and Judy finished in 87.3 minutes, while Kyle finished in 96.6 minutes. We can create Python variables with those values like this:
>>> judy = 87.3 >>> kyle = 96.6
To find the winner, we can use some if
statements like this:
>>> if judy < kyle: ... print "Judy wins with a time of", judy ... elif judy > kyle: ... print "Kyle wins with a time of", kyle ... else: ... print "Judy and Kyle are tied with a time of", judy ... Judy wins with a time of 87.3 >>>
If Judy and Kyle are the only two snails, this program will work fine. Malek puts this all into a script. After each race, he changes the first two lines that give the finish times, and then runs the script.
This will work, but there are a number of objections:
The person who prepares the race results has to know Python so they can edit the script.
It doesn't really save any time. Any second-grader can look at the times and figure out who won.
The names of the snails are part of the program, so if different snails are used, we have to write a new program.
What if there are three snails? There are a lot more cases: three cases where a snail clearly wins; three more possible two-way ties; and a three-way tie. What if Malek wants to race ten snails at once? Too complicated!