# 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)
# 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)
# Please write the python code to (Don’t achieve this task by using the pandas package. It is intended to train your logic thinking of how to use if statement and for statement.)
importcsv
transactions=[]
withopen("supermarket_hw6.csv","r")asfile:
reader=csv.DictReader(file)
transactions=list(reader)
# (1) Show the product name of all the items purchased in the transaction number T005. (Hint: you should have the following 2 items: “EGGPLANT,and MILK”)
fortintransactions:
ift.get("Transaction Number")=="T005":
print("Product Name: ",t.get("Product Name"))
# (2) Maintain a list of all the customer account id. (Hint: you should have [‘C001’, ‘C002’,‘C003’])
# Use numpy to calculate the likelihood ratio for the following data with the formula: f(x) (Use the np.log() function not the math.log() function. Hint: 87.18, 2678.36, 77.20, 405.47)
# (1) Show the product name of all the items purchased in the transaction number T005. (Hint: you should have the following 2 items: “EGGPLANT,and MILK”)