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.98 tracks/python/exercises/bob/example.py
trackler-2.2.1.97 tracks/python/exercises/bob/example.py
trackler-2.2.1.96 tracks/python/exercises/bob/example.py