mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
restructure base
This commit is contained in:
14
mathgenerator/funcs/profitLossPercentFunc.py
Normal file
14
mathgenerator/funcs/profitLossPercentFunc.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def profitLossPercentFunc(maxCP = 1000, maxSP = 1000):
|
||||
cP = random.randint(1, maxCP)
|
||||
sP = random.randint(1, maxSP)
|
||||
diff = abs(sP-cP)
|
||||
if (sP-cP >= 0):
|
||||
profitOrLoss = "Profit"
|
||||
else:
|
||||
profitOrLoss = "Loss"
|
||||
percent = diff/cP * 100
|
||||
problem = f"{profitOrLoss} percent when CP = {cP} and SP = {sP} is: "
|
||||
solution = percent
|
||||
Reference in New Issue
Block a user