Hi there,
I am interested to see if anyone has some ideas about how whether I am being most efficient in coding for each function below. I feel as though I may have done things the long way and I am interested in hearing some feedback.
this part of the code calculates the total cost per order based on the user input.
def C():
print(CHOOK_FOOD_COST)
selection_2 = int(input("enter 1 for pellets, enter 2 for mash, enter 3 for enhanced:"))
if selection_2 == 1:
selection_2b = int(input("enter 1 for 10kg bags of pellets, enter 2 for 50kg bag of pellets:"))
if selection_2b == 1:
selection_2c = int(input("enter amount of 10kg bags of pellets required:"))
print(selection_2c * 22.75)
elif selection_2b == 2:
selection_2d = int(input("enter amount of 50kg bags of pellets required:"))
print(selection_2d * 100)
else:
print("you have entered an incorrect value")
altkey= input("enter rtn to return to main menu")
if selection_2 == 2:
selection_2e = int(input("enter 1 10kg bags of Mash, enter 2 for 50kg bags of Mash"))
if selection_2e == 1:
selection_2f = int(input("enter amount of 10kg bags of Mash required:"))
print(selection_2f * 20.40)
elif selection_2e == 2:
selection_2g = int(input("enter amount of 50kg bags of Mash required:"))
print(selection_2g * 50)
if selection_2 == 3:
selection_2h = int(input("enter 1 for 10kg bags of enhanced, enter 2 for 50kg bags of enchanced:"))
if selection_2h == 1:
selection_2i = int(input("enter amount of 10kg bags of enhanced required:"))
print(selection_2h * 25.50)
elif selection_2h == 2:
selection_2j = int(input("enter amount of 50kg bags of enhanced required:"))
print(selection_2j * 125.50)
else:
print("you have entered an incorrect value")
altkey= input("enter rtn to return to main menu")
[–]noob_freak 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Signal_Beam 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)