def get_clouds_img(clouds, d): clouds_ranges = { '800': '0', '801': '1', '802': '2', '803': '3', '804': '5', } if clouds in clouds_ranges: return file_name_prefix(d) + clouds_ranges[clouds] return file_name_prefix(d) + '5'
def get_clouds_img(clouds, d): clouds_ranges = [ xrange(0, 5), xrange(5, 10), xrange(10, 20), xrange(20, 25), xrange(25, 30), xrange(30, 101), ] for num, clouds_range in enumerate(clouds_ranges): if clouds in clouds_range: return file_name_prefix(d) + str(num) return 'na'