Commit c060c7a1 authored by MichaelAng's avatar MichaelAng

[ban265] hw5

parent f007e341
......@@ -31,6 +31,11 @@ run_hw4:
$(DOCKER_BASE_CMD) \
ban265 "hw4.py"
.PHONY: run_hw5
run_hw5:
$(DOCKER_BASE_CMD) \
ban265 "hw5.py"
.PHONY: fmt
fmt:
$(DOCKER_BASE_CMD) \
......
# Ang, Michael
# BAN 265 A
# Homework 4
# 2024-03-26
# https://www.dropbox.com/s/3yiq5abh7v8tz6w/PY_hw5.docx?dl=0
# 1. BMI for a person is calculated as weight in kg / (height in meters * height in meters). You need to calculate everyone in the following list variables. (Hint: 23.31, 25.98, 24.54)
v_weight = [65, 87, 76]
v_height = [1.67, 1.83, 1.76]
print([round(w / h**2, 2) for w, h in zip(v_weight, v_height)])
# 2. BMI for a person is calculated as weight in kg / (height in meters * height in meters). You need to calculate everyone in the following dictionary variables. (Hint: Alice 23.31, Bob 25.98, Cindy 24.54)
v_weight = {"Bob":87, "Cindy":76, "Alice":65}
v_height = {"Alice":1.67, "Cindy":1.76, "Bob":1.83}
print({k: round(v_weight[k] / v_height[k]**2, 2) for k in v_weight.keys()})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment