-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path09-Birthday_Cake_Candles.py
More file actions
38 lines (27 loc) · 895 Bytes
/
09-Birthday_Cake_Candles.py
File metadata and controls
38 lines (27 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
'''
Created on Mon Apr 18 2022
@author: Carlos Páez
'''
#
# Complete the `birthdayCakeCandles` function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER_ARRAY candles as parameter.
#
def birthdayCakeCandles(candles):
"""
It returns the number of times the maximum value in the list occurs
:param candles: an array of integers representing candle heights
:return: The number of candles that are the tallest.
"""
max_candles = max(candles)
return candles.count(max_candles)
# The code that is executed when the file is run as a script.
if __name__ == '__main__':
fptr = open('./output.txt', 'w')
candles_count = int(input().strip())
candles = list(map(int, input().rstrip().split()))
result = birthdayCakeCandles(candles)
fptr.write(str(result) + '\n')
fptr.close()