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")

67 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.

  5. I was curious if you ever thought of changing the page layout
    of your blog? Its very well written; I love what youve
    got to say. But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having 1 or 2 pictures.
    Maybe you could space it out better?

  6. Excellent blog right here! Also your web site loads up fast!

    What host are you the usage of? Can I am getting your associate link for your host?
    I wish my web site loaded up as fast as yours lol

  7. Hello there! I could have sworn I’ve visited this site
    before but after looking at some of the posts I realized it’s new to
    me. Anyhow, I’m definitely happy I discovered it and I’ll be bookmarking it and checking back frequently!

  8. I think this is one of the most important information for
    me. And i am glad reading your article. But should remark on few general things, The website style is ideal, the articles is really excellent : D.
    Good job, cheers

  9. I’m not sure why but this website is loading extremely slow
    for me. Is anyone else having this problem or is it a problem on my end?
    I’ll check back later and see if the problem
    still exists.

  10. Hey very nice website!! Man .. Excellent .. Wonderful ..

    I will bookmark your blog and take the feeds additionally?
    I’m happy to search out a lot of helpful information here in the publish,
    we need work out more techniques in this regard, thank you for sharing.
    . . . . .

  11. Thanks for any other fantastic post. The place else could anyone get that kind of info in such a perfect method of writing?
    I’ve a presentation next week, and I am on the search for such info.

  12. With havin so much content do you ever run into any issues of plagorism or copyright violation? My website has a lot of unique content
    I’ve either created myself or outsourced
    but it looks like a lot of it is popping it up all over the internet without my authorization. Do you know
    any methods to help protect against content from being stolen? I’d genuinely appreciate it.

  13. Thanks for some other informative website. Where else may just I am getting that kind of info written in such a
    perfect approach? I’ve a venture that I’m just now working on, and I
    have been on the glance out for such info.

  14. We stumbled over here coming from a different web page and thought I may as well check things
    out. I like what I see so i am just following you.
    Look forward to finding out about your web page again.

  15. Its like you read my mind! You seem to know so much about this, like you
    wrote the book in it or something. I think that you can do with a few
    pics to drive the message home a little bit, but instead of that, this
    is excellent blog. A fantastic read. I’ll certainly be back.

  16. Hi there! I could have sworn I’ve been to this blog before but after going through many of the posts I realized it’s new to me.
    Nonetheless, I’m definitely happy I came across it and I’ll be
    book-marking it and checking back regularly!

  17. Thank you, I have recently been searching for info approximately this subject for a long time and yours is
    the greatest I’ve discovered till now. But, what about the conclusion? Are you certain about the supply?

  18. Undeniably believe that which you said. Your favorite reason seemed
    to be on the internet the simplest thing to be aware of.
    I say to you, I definitely get annoyed while people consider worries that they plainly do not know about.
    You managed to hit the nail upon the top as well as defined out the whole thing
    without having side effect , people can take a signal.
    Will probably be back to get more. Thanks

  19. Pretty great post. I simply stumbled upon your blog and wished to mention that I
    have really loved browsing your blog posts. In any case I’ll be subscribing in your rss feed and I am hoping you write again very soon!

  20. Its like you read my thoughts! You appear to know a lot about this,
    such as you wrote the e book in it or something.
    I believe that you just could do with some % to pressure the message home a little bit, however instead of that, this is magnificent blog.

    An excellent read. I will definitely be back.

Leave a Comment

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