Create percentageFunc.py

This commit is contained in:
Souvikdeb2612
2020-10-19 21:51:14 +05:30
committed by GitHub
parent b6e73420fd
commit 74aaec3fc6

View File

@@ -0,0 +1,10 @@
from .__init__ import *
def percentageFunc(maxValue = 99, maxpercentage=99):
a = random.randint(1, maxpercentage)
b = random.randint(1, maxValue)
problem = f"What is {a}% of {b}?"
percentage = a/100*b
formatted_float = "{:.2f}".format(percentage)
solution = f"Required percentage = {formatted_float}%"
return problem, solution