aboutsummaryrefslogtreecommitdiff
path: root/challenge-044/lubos-kolouch/python/ch-2.py
blob: 4ad8efde17dfb817f14e572e189cf92ee28fc4db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python
# -*- coding: utf-8 -*-

goal = 200  # Target amount
current = 1  # Current amount
moves = 0  # Number of moves

while current < goal:
    # Check if doubling the current amount gets us closer to the goal
    if current * 2 <= goal - current - 1:
        current *= 2
    else:
        current += 1
    moves += 1

print("To reach $", goal, ", you need", moves, "moves.")