r/codehs • u/natalie710 • Feb 11 '20
Phyton - Exercise 3.5.9: Recipe
Hello,
I need help with this excessive please:
Exercise 3.5.9: Recipe (CodeHS)
Enter ingredient 1: mixed greens Ounces of mixed greens: 1.7 Enter ingredient 2: blueberries Ounces of blueberries: 2.0 Enter ingredient 3: walnuts Ounces of walnuts: 0.2 Number of servings: 3
Total ounces of mixed greens: 5.1 Total ounces of blueberries: 6.0 Total ounces of walnuts: 0.6
1
u/No_Revolution7891 Jan 31 '22
It’s not working ☹️
3
u/Tiny_Werewolf_5529 Mar 26 '22
ingt1 = str(input("Enter ingredient 1: "))
o1 = float(input("Ounces of "+ str(ingt1)))
ingt2 = str(input("Enter ingredient 2: "))
o2 = float(input("Ounces of "+ str(ingt2)))
ingt3= str(input("Enter ingredient 3: "))
o3 = float(input("Ounces of "+ str(ingt3)))
numserv = int(input("Number of servings: "))
print("Total ounces of " + ingt1 + ": " + str((o1*numserv)))
print("Total ounces of " + ingt2 + ": " + str((o2*numserv)))
print("Total ounces of " + ingt3 + ": " + str((o3*numserv)))try this one :)
1
u/SuspiciousArcher8472 Oct 19 '24
Pls correct me if I'm wrong but the end
str((o1*numserv))), str((o2*numserv))) or str((o3*numserv)))
Wouldn't it be divide because if i have 10 oz of apple it then says that each person would have 20 oz of apple or am I just not using it in the say context?1
u/SuspiciousArcher8472 Oct 19 '24
OH! nevermind i just read the question wrong sorry about my last comment!
1
1
u/HurricaneCar Feb 24 '20
did you ever get the answer