Python
 Computer >> コンピューター >  >> プログラミング >> Python

あなたの体のBMI(ボディマス指数)を計算するPythonプログラム


身長と体重を入力する必要があります。私たちの仕事は、数式を使用してBMIを計算することです。

アルゴリズム

Step 1: input height and weight of your body.
Step 2: then applying the formula for calculation BMI.
Step 3: display BMI.

サンプルコード

height = float(input("Enter your height(m): "))
weight = float(input("Enter your weight(kg): "))
print("Your BMI is: ", round(weight / (height * height), 2))

出力

Enter your height (m): 5.8
Input your weight (kg): 64
Your body mass index is:  1.9

  1. ノームソート用のPythonプログラム

    この記事では、以下に示す問題ステートメントの解決策について学習します。 問題の説明 −配列が与えられたので、ノームソートを使用してソートする必要があります。 アルゴリズム 1. Firstly we traverse the array from left to right. 2. Now,if the current element is larger or equal to the previous element then we traverse one step ahead 3. otherwise,if the current element is smaller than the

  2. 四面体の面積を計算するPythonプログラム

    この記事では、特定の問題ステートメントを解決するための解決策とアプローチについて学習します。 問題の説明 −四面体の側面を考えると、四面体を見つける必要があります。 四面体は、三角形の底面を持つピラミッドのように見える幾何学的図形です。これは、4つの三角形の面、側面に3つ、ベースの下部に1つ、頂点またはコーナーが4つあるソリッドオブジェクトです。 ここでは、以下に示すようにエリア関数をフレーム化します- 例 import math def areatetrahedron(side):    return (math.sqrt(3) * (side * side)) #