Advertisement
theguild42

percent calculation

Nov 26th, 2023
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. def percent(expression="1000*12%") -> float:
  2. if "%" in expression:
  3. expression = expression.replace("%","")
  4. a, b = expression.split("*")
  5. a, b = float(a), float(b)
  6. return a*b/100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement