Translate to Traditional Chinese (δΈ­ζ–‡):

<< Prev   🏠 A B C D E F G Next >>


D.py - Calculate BMI

Write a Python program that asks the user to enter their weight in kilograms and height in meters. Note that weight and height are float number. The program should calculate the Body Mass Index (BMI) using the formula:

Display the result on the screen, as shown in the examples below.

Hint: To enter an float number, use weight = float(input("Enter weight in kg: "))

Example 1:
Enter weight in kg: 70
Enter height in meters: 1.75
BMI: 22.86

Example 2:
Enter weight in kg: 55
Enter height in meters: 1.60
BMI: 21.48


<< Prev   🏠 A B C D E F G    Next >>