From a6c7ea27901b2194229bfcee2d9cd0d79e9990e5 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Thu, 25 Sep 2025 12:48:39 -0700 Subject: [PATCH] =?UTF-8?q?Pok=C3=A9mon=20GO=20Level=20Calculator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pogo-level.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pogo-level.py diff --git a/pogo-level.py b/pogo-level.py new file mode 100644 index 0000000..a90205e --- /dev/null +++ b/pogo-level.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# Description: Calculate Pokémon GO trainer level from total XP +# Usage: python3 pogo-level.py +# Author: Justin Oros +# Source: https://github.com/JustinOros + +import sys + +# XP thresholds for levels 1–80 (cumulative XP) +xp_thresholds = [ + 0, 1000, 3000, 6000, 10000, 15000, 21000, 28000, 36000, 45000, # 1–10 + 55000, 65000, 75000, 85000, 100000, 120000, 140000, 160000, 185000, 210000, # 11–20 + 260000, 335000, 435000, 560000, 710000, 900000, 1100000, 1350000, 1650000, 2000000, # 21–30 + 2500000, 3000000, 3750000, 4750000, 6000000, 7500000, 9500000, 12000000, 15000000, 20000000, # 31–40 + 26000000, 33500000, 42500000, 43500000, 66500000, 82000000, 100000000, 121000000, 146000000, 176000000, # 41–50 + 206000000, 236000000, 266000000, 296000000, 326000000, 356000000, 386000000, 416000000, 446000000, 476000000, # 51–60 + 506000000, 536000000, 566000000, 596000000, 626000000, 656000000, 686000000, 716000000, 746000000, 776000000, # 61–70 + 806000000, 836000000, 866000000, 896000000, 926000000, 956000000, 986000000, 1016000000, 1046000000, 1076000000, # 71–80 +] + +def main(): + try: + xp_input = input("Enter your total XP: ").replace(',', '').strip() + xp = int(xp_input) + except ValueError: + print("Please enter a valid number for XP.") + sys.exit(1) + + level = 1 + for i, threshold in enumerate(xp_thresholds): + if xp >= threshold: + level = i + 1 + else: + break + + print(f"Current Level: {level}") + + if level < 80: + xp_to_next_level = xp_thresholds[level] - xp + xp_to_level_80 = xp_thresholds[79] - xp + print(f"XP to next level: {xp_to_next_level:,}") + print(f"XP to Level 80: {xp_to_level_80:,}") + else: + print("You have reached the maximum level (Level 80)!") + +if __name__ == "__main__": + main()