Python - Calculate Days in Inventory
by matt392 in Circuits > Software
54 Views, 1 Favorites, 0 Comments
Python - Calculate Days in Inventory
print ("This program will calculate the days in inventory.") import math ### Formula for calculating the days in inventory: # DaysInInventory = (AverageOfInventory/(TotalCostOfGoodsSold/365) ########################################### # Enter the AverageOfInventory, TotalCostOfGoodsSold def SolveForDaysInInventory(): print ("Solving for the days in inventory.") # Enter the average of inventory levels AverageOfInventory = float(input("Enter the average of inventory levels: ") ) # Enter the total cost of goods sold per year TotalCostOfGoodsSold = float(input("Enter the total cost of goods sold per year: ") ) # Calculate the bottom section BottomSection = (TotalCostOfGoodsSold/365) print("The bottom section is: ", BottomSection) # Calculate the days in inventory DaysInInventory = (AverageOfInventory/BottomSection) print("The days in inventory is: ", DaysInInventory, " days.") ContinueCalculations = "y" # Check to see if the user wants to continue to calculate the days in inventory while (ContinueCalculations=="y"): SolveForDaysInInventory() ContinueCalculations = input("Would like to do another calculation for the days in inventory? (y/n): ") print("==================================") print ("Thank you to www.fxsolver.com for assistance with this formula.")