Suzuki is a monk who climbs a large staircase to the monastery as part of a ritual. Some days he climbs more stairs than others depending on the number of students he must train in the morning. He is curious how many stairs might be climbed over the next 20 years and has spent a year marking down his daily progress.
The sum of all the stairs logged in a year will be used for estimating the number he might climb in 20.
20_year_estimate = one_year_total * 20
You will receive the following data structure representing the stairs Suzuki logged in a year. You will have all data for the entire year so regardless of how it is logged the problem should be simple to solve.
stairs = [sunday,monday,tuesday,wednesday,thursday,friday,saturday]
Make sure your solution takes into account all of the nesting within the stairs array.
Each weekday in the stairs array is an array.
sunday = [6737, 7244, 5776, 9826, 7057, 9247, 5842, 5484, 6543, 5153, 6832, 8274, 7148, 6152, 5940, 8040, 9174, 7555, 7682, 5252, 8793, 8837, 7320, 8478, 6063, 5751, 9716, 5085, 7315, 7859, 6628, 5425, 6331, 7097, 6249, 8381, 5936, 8496, 6934, 8347, 7036, 6421, 6510, 5821, 8602, 5312, 7836, 8032, 9871, 5990, 6309, 7825]
Solution:
def year_stairs(func):
def wrapper(stairs):
return func(sum(sum(i) for i in stairs))
return wrapper
@year_stairs
def stairs_in_20(year_stairs):
return year_stairs * 20
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1101. Fix your code before the garden dies! (0) | 2022.11.01 |
---|---|
1031. Vowel remover (0) | 2022.10.31 |
1029. Printing Array elements with Comma delimiters (0) | 2022.10.29 |
1028. Will you make it? (0) | 2022.10.29 |
1027. Filling an array (part 1) (0) | 2022.10.28 |