On BBC Radio 2, on Saturdays there's a show hosted by Tony Blackburn called Pick of the Pops. Here, Tony selects a random week from a random year (in the range 1960-1989), and plays the songs which were in the top 20 charts at the time.
Given a list of songs played on one Pick of the Pops episode, you must determine the year which Tony has chosen.
The input will be given as a string (either by STDIN or function arguments), with each list item separated by a comma.
The input will sorted with the number one single first, carrying on in order until the list ends with the number 20 single.
On the actual show, Blackburn plays the charts for two different years. This will not be the case for your input, only the chart for your one year will be supplied.
If song usually has a comma in its name, then the comma will be omitted.
Your output should simply be the year in the format
If for any reason, multiple years are found (say if the charts are form the first week of the year), then either select the first year or output both, comma separated.
You can read from either a file or the internet.
If you use the internet, you must only use pages on the website
Note: if you read from a Wikipedia page, the page must have been created before the 23rd of August 2015.
The charts will be from the national UK charts, not international or of any other country.
Your output must be in the range of 1960 - 1989.
Ticket to Ride,Here Comes the Night,The Minute You're Gone,Concrete and Clay,Little Things,Catch the Wind,For Your Love,King of the Road,The Last Time,Pop Go the Workers,Bring It On Home to Me,Stop in the Name of Love,Times They Are A-Changin',You're Breakin' My Heart,I Can't Explain,I'll Be There,Everybody's Gonna Be Happy,It's Not Usual,A World of Our Own,True Love Ways
The person with the shortest program in bytes wins.
At the moment, I'm still downloading all of the chart information, but you can use the following Python 2 code to retrieve the necessary information and create the file. (Requires the requests module)
import requests, re, datetime, time date = datetime.date(1960,1,1) prevyear=0 year = 1960 delay = # Set the delay yourself. So far 4 seconds still makes the download fail while date.year != 1990: response = requests.get("http://www.officialcharts.com/charts/singles-chart/%d%02d%02d"%(date.year, date.month, date.day)).text time.sleep(delay) tags = re.findall("<a href=\"/search/singles/.+\">.+</a>", response)[:20] top20s =  for i in tags[:]: tag = re.sub("<a href=\"/search/singles/.+\">", "", i) tag = re.sub("</a>","",tag) top20s.append(tag) top20s = list(map(lambda x:x.replace(",",""), top20s)) with open("songs.txt", "a") as f: if year != prevyear: string = str(year)+"\n" else: string = "" chart = ",".join(top20s) f.write(string+chart+"\n") prevyear = year date += datetime.timedelta(days=7) year = date.year