Pathl.Stona/models/Power/model.py

17 lines
467 B
Python
Raw Normal View History

2026-01-30 12:33:51 +00:00
def oblicz_potega(x, typ):
"""
Funkcja oblicza kwadrat lub sześcian liczby x w zależności od parametru typ.
Parametry:
x (int/float): liczba, którą chcemy podnieść do potęgi
typ (str): "kwadrat" lub "sześcian"
Zwraca:
int/float: wynik działania
"""
if typ == "kwadrat":
return x ** 2
elif typ == "sześcian":
return x ** 3
else:
return "Niepoprawny typ. Wpisz 'kwadrat' lub 'sześcian'."