Sha256: 24f278debc28e05ff13494ec76ff6264b604e47ee788245109770a2cec10842d

Contents?: true

Size: 457 Bytes

Versions: 313

Compression:

Stored size: 457 Bytes

Contents

def hey(stimulus):
    stimulus = stimulus.strip()

    if _is_silence(stimulus):
        return 'Fine. Be that way!'
    elif _is_shouting(stimulus):
        return 'Whoa, chill out!'
    elif _is_question(stimulus):
        return 'Sure.'
    else:
        return 'Whatever.'


def _is_silence(stimulus):
    return stimulus == ''


def _is_shouting(stimulus):
    return stimulus.isupper()


def _is_question(stimulus):
    return stimulus.endswith('?')

Version data entries

313 entries across 313 versions & 1 rubygems

Version Path
trackler-2.2.1.95 tracks/python/exercises/bob/example.py
trackler-2.2.1.94 tracks/python/exercises/bob/example.py
trackler-2.2.1.93 tracks/python/exercises/bob/example.py
trackler-2.2.1.92 tracks/python/exercises/bob/example.py
trackler-2.2.1.91 tracks/python/exercises/bob/example.py
trackler-2.2.1.90 tracks/python/exercises/bob/example.py
trackler-2.2.1.89 tracks/python/exercises/bob/example.py
trackler-2.2.1.88 tracks/python/exercises/bob/example.py
trackler-2.2.1.87 tracks/python/exercises/bob/example.py
trackler-2.2.1.86 tracks/python/exercises/bob/example.py
trackler-2.2.1.85 tracks/python/exercises/bob/example.py
trackler-2.2.1.84 tracks/python/exercises/bob/example.py
trackler-2.2.1.83 tracks/python/exercises/bob/example.py
trackler-2.2.1.82 tracks/python/exercises/bob/example.py
trackler-2.2.1.81 tracks/python/exercises/bob/example.py
trackler-2.2.1.80 tracks/python/exercises/bob/example.py
trackler-2.2.1.79 tracks/python/exercises/bob/example.py
trackler-2.2.1.78 tracks/python/exercises/bob/example.py
trackler-2.2.1.77 tracks/python/exercises/bob/example.py
trackler-2.2.1.76 tracks/python/exercises/bob/example.py