-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbirthday_cake_candles.py
48 lines (31 loc) · 1019 Bytes
/
birthday_cake_candles.py
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
39
40
41
42
43
44
45
46
47
48
'''
You are in charge of the cake for a child's birthday.
You have decided the cake will have one candle for each year of their total age.
They will only be able to blow out the tallest of the candles. Count how many candles are tallest.
Function Description
Complete the function birthdayCakeCandles in the editor below.
birthdayCakeCandles has the following parameter(s):
int candles[n]: the candle heights
Returns
int: the number of candles that are tallest
'''
import math
import os
import random
import re
import sys
def birthdayCakeCandles(candles):
count = 0
size = len(candles)
tallest_candles = max(candles)
for x in range(size):
if candles[x] == tallest_candles:
count += 1
return count
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
candles_count = int(input().strip())
candles = list(map(int, input().rstrip().split()))
result = birthdayCakeCandles(candles)
fptr.write(str(result) + '\n')
fptr.close()