This commit is contained in:
2025-12-17 14:30:58 +01:00
parent d26863e5d1
commit 814eb25486
2 changed files with 50 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ def czytaj_dana_float(tekst: str, minimum: float = 1.0, maximum: float = 20.0 )-
wys_p = czytaj_dana_float("Podaj wysokość", 3)
pre_p = czytaj_dana_float()
print(f"{wys_p=} {pre_p=}")
print(f"{wys_p=} {pre_p=}") fgsdfgsdfgsdfgsdfgdsfgfd
# zadanie:
zdefiniuj funkcję, która pobiera wartość netto, stawkę vat (domyślnie 5),

49
dzien_03/skrypt_04.py Normal file
View File

@@ -0,0 +1,49 @@
import matplotlib.pyplot as plt
import numpy as np
def czytaj_dana_float(tekst: str, minimum: float = 1.0, maximum: float = 20.0 )-> float:
"""
Docstring for czytaj_dana_float - czyli krótka dokumentacja funkcji
:param tekst: Description - tu ma być tekst dla usera
:type tekst: str
:param minimum: Description - minimalna wartość
:type minimum: float
:param maximum: Description
:type maximum: float
:return: wczytana z klaimport matplotlib.pyplot as plt
import numpy as npwiatyru wartość typu float
:rtype: float
"""
tmp_value = None
ret_value = None
value_ok = False
print(f"{minimum=}")
while not value_ok:
tmp_value = input(f"{tekst} - pamiętaj o {minimum=} i {maximum=}: ")
try:
ret_value = float(tmp_value)
value_ok = True
print("Super!")
if ret_value < minimum:
ret_value = minimum
if ret_value > maximum:
ret_value = maximum
except:
print(f"Wrowadziłeś błędnie: {tmp_value} - spróbuj ponownie...")
return ret_value
H_START = czytaj_dana_float("Podaj wysokość startową",3.0)
V_START = czytaj_dana_float("Podaj prędkość startową")
# Obliczamy najważniejsze wartości
g = 9.81 # m/s^2
total_time = ((2 * H_START) / g) ** (1 / 2)
max_range = V_START * total_time