months = 13 while months: print('Enter the numonthsber of months (To exit, enter "0"): ') months = int(input()) if (months == 12 or months == 1 or months == 2): print('Winter') elif (months == 3 or months == 4 or months == 5): print('Spring') elif (months == 6 or months == 7 or months == 8): print('Summer') elif (months == 9 or months == 10 or months == 11): print('Autumn') else: print('To exit, enter "0"')
Можно ли тоже самое решить с помощью списка или словоря?
Что-то вроде:
m = {[1,2,3] : "a", 2 : "b"}
