BMI Calculator

BMI Calculator

Program in Python to compute the BMI of a person and display the  risk associated with it by entering the height in ‘m’ and weight in’ kg’. Refer the following table and code accordingly.


  • To calculate the BMI apply the formula:  BMI = weight(kg)/( height(m)*height(m) ).    
  • Result must be adjusted to one decimal place. 
  • When the height or weight is entered as a negative number or  zero, then display the message “Provide a valid input” and stop the program.
27.5 and aboveHigh Risk
23 – 27.4Moderate Risk
18.5 – 22.9Low Risk
Below 18.5Risk of nutritional deficiency diseases

Sample Input 1:

Enter the weight of the person(kg):85

Enter the height of the person(m):1.75

Sample Output 1:

Your BMI is 27.8 (High Risk).

Sample Input 2:

Enter the weight of the person(kg):0

Enter the height of the person(m):1.58

Sample Output 2:

Provide a valid input

Sample Input 3:

Enter the weight of the person(kg):80

Enter the height of the person(m):-1

Sample Output 3:

Provide a valid input

Code :-

w=int(input("Enter the weight of the person(kg):"))
h=float(input("Enter the height of the person(m):"))
if w>0 and h>0:
    if b>=27.5:
        print("Your BMI is "+str(b)+" (High Risk)")
    elif b>=23 and b<=27.4:
        print("Your BMI is "+str(b)+" (Moderate Risk)")
    elif b>=18.5 and b<=22.9:
        print("Your BMI is "+str(b)+" (Low Risk)")
    elif b<18.5:
        print("Your BMI is "+str(b)+" (Risk of nutritional deficiency diseases)")
    print("Provide a valid input")

18 thoughts on “BMI Calculator”

  1. I look after a vape store directory site and we have had a listing from a vape shop in the United States that additionally advertises CBD items. A Month later on, PayPal has contacted use to claim that our account has been restricted and have requested us to get rid of PayPal as a payment solution from our vape store web directory. We do not offer for sale CBD items such as CBD oil. We only offer promotion and marketing solutions to CBD firms. I have checked out Holland & Barrett– the UK’s Reputable Health Retail store and if you take a close look, you will see that they sell a rather extensive range of CBD product lines, specifically CBD oil and they also happen to accept PayPal as a payment solution. It seems that PayPal is administering twos sets of rules to different firms. As a result of this limitation, I can no longer take PayPal on my CBD-related website. This has restrained my payment choices and currently, I am heavily dependent on Cryptocurrency payments and direct bank transfers. I have checked with a solicitor from a Magic Circle law practice in The city of london and they said that what PayPal is undertaking is totally illegal and discriminatory as it should be applying a systematic benchmark to all companies. I am yet to seek advice from a different attorney from a US law firm in London to see what PayPal’s legal position is in the USA. In the meantime, I would be very appreciative if anybody here at targetdomain could offer me with substitute payment processors/merchants that work with CBD firms.

  2. Woah! I’m really enjoying the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s
    challenging to get that “perfect balance” between user friendliness and visual appeal.
    I must say that you’ve done a fantastic job with this.
    Additionally, the blog loads super fast for me on Firefox.

    Superb Blog!

  3. Fantastic web site. A lot of useful information here.
    I’m sending it to some pals ans additionally sharing in delicious.
    And naturally, thank you on your effort!

  4. I am really impressed with your writing skills as well as with the layout on your blog.

    Is this a paid theme or did you customize it yourself?
    Either way keep up the excellent quality writing, it is rare to see a
    nice blog like this one these days.

Leave a Comment

Your email address will not be published. Required fields are marked *