From f164003ac237faa9d33ecc3fbeef3bafbcb13752 Mon Sep 17 00:00:00 2001 From: harshitptl21 <104129717+harshitptl21@users.noreply.github.com> Date: Sat, 8 Oct 2022 08:25:15 +0530 Subject: [PATCH] Update Calculator.py --- bmi_calculator/Calculator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bmi_calculator/Calculator.py b/bmi_calculator/Calculator.py index 1f4d62cbe..67391c0ce 100644 --- a/bmi_calculator/Calculator.py +++ b/bmi_calculator/Calculator.py @@ -9,7 +9,7 @@ def reset_entry(): def calculate_bmi(): - kg = int(weight_tf.get()) + kg = float(weight_tf.get()) m = int(height_tf.get()) / 100 bmi = kg / (m * m) bmi = round(bmi, 1) @@ -19,11 +19,11 @@ def calculate_bmi(): def bmi_index(bmi): if bmi < 18.5: messagebox.showinfo('bmi-pythonguides', f'BMI = {bmi} is Underweight') - elif (bmi > 18.5) and (bmi < 24.9): + elif (bmi >= 18.5) and (bmi <= 24.9): messagebox.showinfo('bmi-pythonguides', f'BMI = {bmi} is Normal') - elif (bmi > 24.9) and (bmi < 29.9): + elif (bmi >= 25) and (bmi <= 29.9): messagebox.showinfo('bmi-pythonguides', f'BMI = {bmi} is Overweight') - elif (bmi > 29.9): + elif (bmi >= 30): messagebox.showinfo('bmi-pythonguides', f'BMI = {bmi} is Obesity') else: messagebox.showerror('bmi-pythonguides', 'something went wrong!')