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.159 tracks/python/exercises/bob/example.py
trackler-2.2.1.158 tracks/python/exercises/bob/example.py
trackler-2.2.1.157 tracks/python/exercises/bob/example.py
trackler-2.2.1.156 tracks/python/exercises/bob/example.py
trackler-2.2.1.155 tracks/python/exercises/bob/example.py
trackler-2.2.1.154 tracks/python/exercises/bob/example.py
trackler-2.2.1.153 tracks/python/exercises/bob/example.py
trackler-2.2.1.152 tracks/python/exercises/bob/example.py
trackler-2.2.1.151 tracks/python/exercises/bob/example.py
trackler-2.2.1.150 tracks/python/exercises/bob/example.py
trackler-2.2.1.149 tracks/python/exercises/bob/example.py
trackler-2.2.1.148 tracks/python/exercises/bob/example.py
trackler-2.2.1.147 tracks/python/exercises/bob/example.py
trackler-2.2.1.146 tracks/python/exercises/bob/example.py
trackler-2.2.1.145 tracks/python/exercises/bob/example.py
trackler-2.2.1.144 tracks/python/exercises/bob/example.py
trackler-2.2.1.143 tracks/python/exercises/bob/example.py
trackler-2.2.1.142 tracks/python/exercises/bob/example.py
trackler-2.2.1.141 tracks/python/exercises/bob/example.py
trackler-2.2.1.140 tracks/python/exercises/bob/example.py