Sha256: a48d2b5339a14ec567cf52c641756533e59fb980c009a926a1cca2c662d635f6

Contents?: true

Size: 563 Bytes

Versions: 83

Compression:

Stored size: 563 Bytes

Contents

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

    if _is_silence(stimulus):
        return 'Fine. Be that way!'
    if _is_shouting(stimulus):
        if _is_question(stimulus):
            return "Calm down, I know what I'm doing!"
        else:
            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

83 entries across 83 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/bob/example.py
trackler-2.2.1.179 tracks/python/exercises/bob/example.py
trackler-2.2.1.178 tracks/python/exercises/bob/example.py
trackler-2.2.1.177 tracks/python/exercises/bob/example.py
trackler-2.2.1.176 tracks/python/exercises/bob/example.py
trackler-2.2.1.175 tracks/python/exercises/bob/example.py
trackler-2.2.1.174 tracks/python/exercises/bob/example.py
trackler-2.2.1.173 tracks/python/exercises/bob/example.py
trackler-2.2.1.172 tracks/python/exercises/bob/example.py
trackler-2.2.1.171 tracks/python/exercises/bob/example.py
trackler-2.2.1.170 tracks/python/exercises/bob/example.py
trackler-2.2.1.169 tracks/python/exercises/bob/example.py
trackler-2.2.1.167 tracks/python/exercises/bob/example.py
trackler-2.2.1.166 tracks/python/exercises/bob/example.py
trackler-2.2.1.165 tracks/python/exercises/bob/example.py
trackler-2.2.1.164 tracks/python/exercises/bob/example.py
trackler-2.2.1.163 tracks/python/exercises/bob/example.py
trackler-2.2.1.162 tracks/python/exercises/bob/example.py
trackler-2.2.1.161 tracks/python/exercises/bob/example.py
trackler-2.2.1.160 tracks/python/exercises/bob/example.py