Есть ли более короткий, более разборчивый стиль кода для решения этой проблемы? Я пытаюсь классифицировать некоторые значения с плавающей точкой в межрегиональные папки.
def classify(value):
if value < -0.85 and value >= -0.95:
ts_folder = r'\-0.9'
elif value < -0.75 and value >= -0.85:
ts_folder = r'\-0.8'
elif value < -0.65 and value >= -0.75:
ts_folder = r'\-0.7'
elif value < -0.55 and value >= -0.65:
ts_folder = r'\-0.6'
elif value < -0.45 and value >= -0.55:
ts_folder = r'\-0.5'
elif value < -0.35 and value >= -0.45:
ts_folder = r'\-0.4'
elif value < -0.25 and value >= -0.35:
ts_folder = r'\-0.3'
elif value < -0.15 and value >= -0.25:
ts_folder = r'\-0.2'
elif value < -0.05 and value >= -0.15:
ts_folder = r'\-0.1'
elif value < 0.05 and value >= -0.05:
ts_folder = r'\0.0'
elif value < 0.15 and value >= 0.05:
ts_folder = r'\0.1'
elif value < 0.25 and value >= 0.15:
ts_folder = r'\0.2'
elif value < 0.35 and value >= 0.25:
ts_folder = r'\0.3'
elif value < 0.45 and value >= 0.35:
ts_folder = r'\0.4'
elif value < 0.55 and value >= 0.45:
ts_folder = r'\0.5'
elif value < 0.65 and value >= 0.55:
ts_folder = r'\0.6'
elif value < 0.75 and value >= 0.65:
ts_folder = r'\0.7'
elif value < 0.85 and value >= 0.75:
ts_folder = r'\0.8'
elif value < 0.95 and value >= 0.85:
ts_folder = r'\0.9'
return ts_folder