The Force is Strong with this one [Jan. 27, 2012, 4:07 p.m.]
Your script is running smoothly and looking lovely! Congratulations.
There's one small modification we could make to the script so that it could be useful for any search term. That's a lot of search terms :) And it certainly makes the script a lot more flexible.
You have two options for implementing this functionality. Command line arguments and user prompt.
Command Line Arguments
The first is to make your program take an argument when you first run it from the command line. Instead of
$ ruby myscript.rb
you would run
$ ruby myscript.rb searchterm
(and similarly for python).
When you pass arguments to a script in this way, they are stored in a list named, in both languages, ARGV (for historical reasons). In Ruby, ARGV is a global array, and the first argument to your script is stored in ARGV[0].
In Python, in order to access the ARGV variable you must import the sys module (import sys). The first program argument is stored in sys.ARGV[1].
User Prompt
Modifying your API Call
Now that you have your search_term variable, you'll need to modify the api_call string (remember, from task 5?) so that the search term is inserted into the url. You can do this either by using string formatting, as we did in the previous task, or you can use string concatenation.
Read about string concatenation or formatting if you need to, and then make the necessary change to your script. Once you have inserted the search_term variable into the api_call string, everything else is the same. Not so bad, is it?
Did you do any error checking to see if the user submitted a value before retrieving it? What happens if the user doesn't give an argument? Where does your program fail? How could you make it more robust?
Post the approach you took to the comments, and share any particularly good resources you came across. You don't have to implement error checking for this challenge, but it's good practice to start thinking about it! (And you are, of course, most welcome to implement it if you like).