TDT4109/Exercise 4 - Inspera/20.py

13 lines
423 B
Python
Raw Normal View History

2020-10-01 12:05:45 +02:00
def cubeInput():
while True:
try:
l,w,h = (float(input('Lengde: ')), float(input('Bredde: ')), float(input('Høyde: ')))
assert w != l and l != h and w != h
return (l,w,h)
except AssertionError:
print('Morten er ikke fornøyd, prøv igjen')
except ValueError:
print('Det er ikke et tall, prøv igjen')
d = min(cubeInput())
print(f'Den største kuben vil ha et volum på {d**3}')