# Profit and Loss
# Function to calculate Profit.
def Profit(costPrice, sellingPrice):
profit = (sellingPrice - costPrice)
return profit
# Function to calculate Loss.
def Loss(costPrice, sellingPrice):
Loss = (costPrice - sellingPrice)
return Loss
if __name__ == "__main__":
input(costPrice, sellingPrice)
if sellingPrice == costPrice:
print("No profit nor Loss")
elif sellingPrice > costPrice:
print(Profit(costPrice,
sellingPrice), "Profit")
else:
print(Loss(costPrice,
sellingPrice), "Loss")
The error code:
Traceback (most recent call last): File "C:/Users/sharv/PycharmProjects/FInal Robotic/Finals.py", line 18, in <module>
input(costPrice, sellingPrice) NameError: name 'costPrice' is not defined
Process finished with exit code 1