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.119 tracks/python/exercises/bob/example.py
trackler-2.2.1.118 tracks/python/exercises/bob/example.py
trackler-2.2.1.117 tracks/python/exercises/bob/example.py
trackler-2.2.1.116 tracks/python/exercises/bob/example.py
trackler-2.2.1.115 tracks/python/exercises/bob/example.py
trackler-2.2.1.114 tracks/python/exercises/bob/example.py
trackler-2.2.1.113 tracks/python/exercises/bob/example.py
trackler-2.2.1.111 tracks/python/exercises/bob/example.py
trackler-2.2.1.110 tracks/python/exercises/bob/example.py
trackler-2.2.1.109 tracks/python/exercises/bob/example.py
trackler-2.2.1.108 tracks/python/exercises/bob/example.py
trackler-2.2.1.107 tracks/python/exercises/bob/example.py
trackler-2.2.1.106 tracks/python/exercises/bob/example.py
trackler-2.2.1.105 tracks/python/exercises/bob/example.py
trackler-2.2.1.104 tracks/python/exercises/bob/example.py
trackler-2.2.1.103 tracks/python/exercises/bob/example.py
trackler-2.2.1.102 tracks/python/exercises/bob/example.py
trackler-2.2.1.101 tracks/python/exercises/bob/example.py
trackler-2.2.1.100 tracks/python/exercises/bob/example.py
trackler-2.2.1.99 tracks/python/exercises/bob/example.py