Kyle Anderson
x0 = 11 x1 = 13 x2 = 17 x3 = 19 total = x0+x1+x2+x3 product = x0*x1*x2*x3 arith_mean = round(total/4,2); geom_mean = round(product**(1/float(4)),2) print("Sum: ", total) print("Product: ", product) print("Arithmetic Mean: ",arith_mean) print("Geometric Mean: ", geom_mean)
ss_cost = 3.95*2 hb_cost = 8.95*2 ds_cost = 2.50*2 subtotal = ss_cost + hb_cost + ds_cost tax = round(subtotal * 0.0475,2) tip = round(subtotal * 0.15,2) total_charge = subtotal + tax + tip print(f"2 Side Salads:\t${ss_cost:5.2f}") print(f"2 Hamburgers:\t${hb_cost:5.2f}") print(f"2 Diet Sodas:\t${ds_cost:5.2f}") print("----------------------") print(f"Subtotal:\t${subtotal:5.2f}") print(f"Tax (4.75%):\t${tax:5.2f}") print(f"Tip (15%):\t${tip:5.2f}") print("----------------------") print(f"Total Charge:\t${total_charge:5.2f}")
def findVolume(r): pi = 3.14519 #pi v = (4/3)*pi*r*r*r return v r1, r2, r3 = 4.6, 7.2, 9.7 ans = findVolume(r1) print("The volume of a sphere with radius",r1,"is equal to ",round(ans,3)) ans = findVolume(r2) print("The volume of a sphere with radius",r2,"is equal to ",round(ans,3)) ans = findVolume(r3) print("The volume of a sphere with radius",r3,"is equal to ",round(ans,3))
p = 210 i = 0.09 t = 10/12 A = p * (1 + i * t) print("Amount repaid: ${:.2f}".format(A))
P = 400 i = 0.05 t = 3 A = p * (1 + i * t) print("Amount repaid: ${:.2f}".format(A))
PMT = 2000 i = 0.04 n = 18 k = (1 + i) **n j = (k - 1) / i A = PMT * j txt="Balance after 18 years: ${G:.2f}" print(txt.format(G = A))
prob_A = 0.6 prob_B = 0.3 prob_A_and_B = prob_A * prob_B prob_A_or_B = (prob_A + prob_B - prob_A_and_B) print("Probability that both people are late: ", prob_A_and_B) print("Probability that at least one person is late: ", prob_A_or_B)
first = " first" last = " last" sid = " 1234" msg = f"First Name:{first}\nLast Name:{last}\nStudent ID:{sid}" print(msg)
print(len(msg)) print(len(msg)-3)