반응형
Timmy & Sarah think they are in love, but around where they live, they will only know once they pick a flower each. If one of the flowers has an even number of petals and the other has an odd number of petals it means they are in love.
Write a function that will take the number of petals of each flower and return true if they are in love and false if they aren't.
Solution:
from typing import List
def get_arr(func):
def wrapper(*args):
return func([*args])
return wrapper
@get_arr
def lovefunc(flowers: List[int]) -> bool:
return sum(flowers) % 2
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
0929. Summing a number's digits (0) | 2022.09.29 |
---|---|
0928. Grasshopper - Terminal game combat function (0) | 2022.09.28 |
0926. Merge two sorted arrays into one (0) | 2022.09.26 |
0925. Thinkful - Logic Drills: Traffic light (0) | 2022.09.25 |
0924. Sum of positive (0) | 2022.09.24 |