aboutsummaryrefslogtreecommitdiff
path: root/challenge-261/sgreen/python/ch-2.py
blob: 90a73a42a92974358d0eee8c93947d8d14b219e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3

import sys


def multiple_by_two(ints: list, start: int) -> int:
    """Multiple the start number by 2 if it is in the list

    Args:
        ints (list): List of integers
        start (int): The starting number

    Returns:
        int: The first value that isn't in the string
    """

    solution = start
    while solution in ints:
        solution *= 2

    return solution


def main():
    # Convert input into integers
    array = [int(n) for n in sys.argv[1:]]
    start = array.pop()
    result = multiple_by_two(array, start)
    print(result)


if __name__ == '__main__':
    main()