Write a function Intro(F_name: str, L_name: str, height: float, weight: float) -> str that:
-
Takes four parameters:
F_name: First name (string).L_name: Last name (string).height: Height in meters (float).weight: Weight in kilograms (float).
-
Returns a string of the form:
"Hi, my name is XY and my BMI is __"where:Xis the first character ofF_name.Yis the first character ofL_name.- BMI is calculated using the formula:
BMI = weight / (height ** 2).
def Intro(F_name: str, L_name: str, height: float, weight: float) -> str:
bmi = weight / (height ** 2)
return f"Hi, my name is {F_name[0]}{L_name[0]} and my BMI is {bmi:.2f}"Input:
("John", "Doe", 1.75, 70)Expected Output:
Hi, my name is JD and my BMI is 22.86
Input:
("Alice", "Smith", 1.60, 55)Expected Output:
Hi, my name is AS and my BMI is 21.48
Input:
("James", "Bond", 1.83, 80)Expected Output:
Hi, my name is JB and my BMI is 23.88
Input:
("Mark", "Ruffalo", 1.73, 72)Expected Output:
Hi, my name is MR and my BMI is 24.06
Input:
("Chris", "Evans", 1.80, 85)Expected Output:
Hi, my name is CE and my BMI is 26.23
Input:
("Henry", "Cavill", 1.85, 92)Expected Output:
Hi, my name is HC and my BMI is 26.88