나는 이렇게 학습한다/Algorithm & SQL

1007. Volume of a Cuboid

daco2020 2022. 10. 8. 15:14
반응형

Bob needs a fast way to calculate the volume of a cuboid with three values: the length, width and height of the cuboid. Write a function to help Bob with this calculation.



Solution:

from typing import List, Callable


def get_multiply(args: List[int], result:int = 1) -> int:
    for i in args: result *= i
    return result        

def get_volume_of_cuboid(length: int, width: int, height: int, func: Callable = get_multiply) -> int:
    return func([length, width, height])    


반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

1009. Surface Area and Volume of a Box  (0) 2022.10.10
1008. Drink about  (0) 2022.10.08
1006. Filter out the geese  (0) 2022.10.06
1005. Palindrome Strings  (0) 2022.10.05
1004. Keep up the hoop  (0) 2022.10.04