18 lines
388 B
Python
18 lines
388 B
Python
from typing import List
|
|
import math
|
|
|
|
def product(numbers: list[float]) -> float:
|
|
|
|
if not numbers:
|
|
raise ValueError('Die Liste darf nicht leer sein ')
|
|
result= 1.0
|
|
for n in numbers:
|
|
if not isinstance(n, (float, int, str)):
|
|
raise ValueError('Ungültig')
|
|
result *= n
|
|
return result
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(product([2, 3, 4]))
|