level.py 478 B

123456789101112131415161718
  1. """Calculate resources koef"""
  2. def calc_koef(level):
  3. """Calculate koef based on level"""
  4. return pow(level, 0.8)
  5. def calc_level_koef(old_level, new_level):
  6. """Calculate resource koef for level"""
  7. old_koef = calc_koef(old_level)
  8. new_koef = calc_koef(new_level)
  9. percentage = 100 / old_koef * new_koef
  10. print("%8.2f%8.2f%8.2f" % (old_koef, new_koef, percentage))
  11. if __name__ == "__main__":
  12. print("old new percentage")
  13. calc_level_koef(86, 92)