I am trying to write out year ranges in the form 2010-11, 2011-12 etc. as strings. The code I am using right now is:
date = ['200' + str(x) + '-' + str(x+1) for x in range(1,9)] + ['20' + str(x) + '-' + str(x+1) for x in range(10,16)]
which outputs
['2001-2', '2002-3', '2003-4', '2004-5', '2005-6', '2006-7', '2007-8', '2008-9', '2010-11', '2011-12', '2012-13', '2013-14', '2014-15', '2015-16']
How can I write this in a single line of code instead of separating into the two cases where the years are <10, >10?
Edit 7/5/20: Have changed the wording to fix opinion-based question.