Pokemon Training Game Python (original) (raw)

Pokémon Training Game - Python

Last Updated : 19 Jan, 2026

A Pokémon trainer catches Pokémon one by one, each having a power level represented by a positive integer. After every catch, the trainer updates the collection and displays the minimum and maximum power levels among all Pokémon caught so far to track the team’s strength. For Example:

**Input: Pokémon powers caught in order - 3 8 9 7
**Output: 3 3
3 8
3 9
3 9

**Explanation:

**Note: Make sure the solution is efficient: it must run in O(N) time, avoid sorting and use only a constant amount of extra space (O(1)).

Python Implementation

The program updates and prints the minimum and maximum Pokémon power levels after each new Pokémon is caught.

Python `

powers = [3, 8, 9, 7] mini = maxi = powers[0] print(mini, maxi)

for power in powers[1:]: mini = min(mini, power) maxi = max(maxi, power) print(mini, maxi)

`

**Output

3 3
3 8
3 9
3 9

**Explanation: