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.139 tracks/python/exercises/bob/example.py
trackler-2.2.1.138 tracks/python/exercises/bob/example.py
trackler-2.2.1.137 tracks/python/exercises/bob/example.py
trackler-2.2.1.136 tracks/python/exercises/bob/example.py
trackler-2.2.1.135 tracks/python/exercises/bob/example.py
trackler-2.2.1.134 tracks/python/exercises/bob/example.py
trackler-2.2.1.133 tracks/python/exercises/bob/example.py
trackler-2.2.1.132 tracks/python/exercises/bob/example.py
trackler-2.2.1.131 tracks/python/exercises/bob/example.py
trackler-2.2.1.130 tracks/python/exercises/bob/example.py
trackler-2.2.1.129 tracks/python/exercises/bob/example.py
trackler-2.2.1.128 tracks/python/exercises/bob/example.py
trackler-2.2.1.127 tracks/python/exercises/bob/example.py
trackler-2.2.1.126 tracks/python/exercises/bob/example.py
trackler-2.2.1.125 tracks/python/exercises/bob/example.py
trackler-2.2.1.124 tracks/python/exercises/bob/example.py
trackler-2.2.1.123 tracks/python/exercises/bob/example.py
trackler-2.2.1.122 tracks/python/exercises/bob/example.py
trackler-2.2.1.121 tracks/python/exercises/bob/example.py
trackler-2.2.1.120 tracks/python/exercises/bob/example.py