Recently, I've got a code test from ABC. Please take a look at this one and give me your idea.
Find the max value of an array of N integers.
E.g.
[ 1, -6, 2, 0, 1011, -355]
Require: the max value is a multiple of 3 and the code focuses on the correctness not performance.
def solution(A):
try:
if not isinstance(A, list):
raise TypeError
max_value = max([x for x in A if x % 3 ==0])
return max_value
except Exception as e:
print(f"{A} is not a list")
print(e)
So does my code fulfill the requirements or Did I miss any edge case? P/s: They announced that was fail and only got 22/100 pts.