aboutsummaryrefslogtreecommitdiff
path: root/challenge-250/sgreen/python/ch-2.py
blob: 9ee64eea3f4a508ecfae736909b1a91ea0716c25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3

import re
import sys


def calculate_value(s):
    '''Return the number if it looks like an integer else the length of string'''
    return int(s) if re.search(r'^\d+$', s) else len(s)


def main(values):
    print(max(map(calculate_value, values)))


if __name__ == '__main__':
    main(sys.argv[1:])