value = float(input(question)) except (ValueError, TypeError): print('To nie jest prawidłowa wartość! Spróbuj jeszcze raz') continue if minimum < value < maximum: break else: print('Podana wartość jest nieprawdopodobna. Spróbuj jeszcze raz') return value def open_advice(filename): filename = filename + ".txt" try: with open(filename) as file: advice = file.read() except FileNotFoundError: advice = 'Nie znaleziono pliku' return advice if __name__ == "__main__": m = get_weight() h = get_height() result = bmi.calculate_BMI(m, h) print(result) print(open_advice(result))
def main_function(): mass, height = get_input_data() bmi_result = calculate_BMI(mass, height) print_advice(bmi_result)