Skip to content

Instantly share code, notes, and snippets.

@iwo-strzebonski
Last active May 18, 2021 08:01
Show Gist options
  • Save iwo-strzebonski/444bfa65758a735f65c00b83a32721a2 to your computer and use it in GitHub Desktop.
Save iwo-strzebonski/444bfa65758a735f65c00b83a32721a2 to your computer and use it in GitHub Desktop.
a = 0
b = 0
while (a <= 0 and b <= 0):
try:
a = float(input('Pierwszy bok [cm]: '))
if a <= 0:
raise ValueError
b = float(input('Drugi bok [cm]: '))
if a <= 0:
raise ValueError
except ValueError:
a = 0
b = 0
else:
break
print(f'Obwod prostokata: {2*a+2*b} [cm]\nPole prostokata {a*b} [cm]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment