Шалом.
Сабж, собственно. Изучаю python и хочу узнать, можно ли более красиво и правильно сделать сие:
if p7 >= 12 and p7 <= 33:
p8="ССВ"
elif p7 >= 34 and p7 <= 56:
p8="СВ"
elif p7 >= 57 and p7 <= 78:
p8="ВСВ"
elif p7 >= 79 and p7 <= 101:
p8="В"
elif p7 >= 102 and p7 <= 123:
p8="ВЮВ"
elif p7 >= 124 and p7 <= 146:
p8="ЮВ"
elif p7 >= 147 and p7 <= 168:
p8="ЮЮВ"
elif p7 >= 169 and p7 <= 191:
p8="Ю"
elif p7 >= 192 and p7 <= 213:
p8="ЮЮЗ"
elif p7 >= 214 and p7 <= 236:
p8="ЮЗ"
elif p7 >= 237 and p7 <= 258:
p8="ЗЮЗ"
elif p7 >= 259 and p7 <= 281:
p8="З"
elif p7 >= 282 and p7 <= 303:
p8="ЗСЗ"
elif p7 >= 304 and p7 <= 326:
p8="СЗ"
elif p7 >= 327 and p7 <= 348:
p8="ССЗ"
elif p7 >= 349 and p7 <= 360:
p8="С"
elif p7 >= 0 and p7 <= 11:
p8="С"
else:
p8="???"
Заранее благодарю за ответ.
//Вышеприведенное переводит градусы в направление ветра.