It’s alive! My first python script

So, recently I started my journey to learn Python. Against all odds I actually started an official course. At a university. I have no coding background, besides my hobby projects. Which are nothing more than codes I found online and then changed to suit my needs. But, it’s here; my very first python script.

I made this as an assignment. I needed to incorporate user input, a calculation, if/elif/else statements and print. I made a BMi calculator. Now, marvel at my code below.

# Jeff van Roosmalen
# User input + calculations + if, elif, else + print
the_height = float(input("Enter your height in cm? "))
the_weight = float(input("Enter your weight in kg? "))
the_BMI = the_weight / (the_height/100)**2
print("Your Body Mass Index is", the_BMI)
if the_BMI <= 18.5:
        print("Oops, you're a little under weight!")
elif the_BMI <= 24.9:
        print("Good, you're perfectly healthy!")
elif the_BMI <= 29.9:
        print("Oops, you're a little over weight!")
else:
        print("Uh oh, you're seriously over weight!")

Comments (

)