Files
2025_12_15_python/dzien_02/skrypt_05.py

31 lines
732 B
Python

nasze_dane = ( 23, 44, 55, 44, 34, 76, 87)
for element in nasze_dane:
if type(element) is str:
break
wynik = round(element / 6,3)
print(f"Wynik dzielenia to {wynik}")
else:
print("Wszystko ok")
##
nasze_dane = ( 23, 44, 55, 44,"A", 34, 76, 87)
for element in nasze_dane:
if type(element) is str:
continue
wynik = element / 6
print(f"Wynik dzielenia to {wynik}")
else:
print("Wszystko ok, nawet gdy continue")
# Zadanie:
# masz dane wejściowe: nasze_dane = (1,2, "Linux", True, 3.44, "Adam")
# przed pętlą zrób listę wyniki = []
# napisz pętlę for, a w bloku kodu zrób tak:
# jeśli element to str lub int, to dodaj go do listy wyniki
# na końcu pętli wyświel wyniki