Sha256: d371335abb487d5891dc26344a635422654ddff8922e05abc25ca2b41c96c8b5

Contents?: true

Size: 512 Bytes

Versions: 130

Compression:

Stored size: 512 Bytes

Contents

class Allergies(object):

    _allergies = [
        "eggs",
        "peanuts",
        "shellfish",
        "strawberries",
        "tomatoes",
        "chocolate",
        "pollen",
        "cats"
    ]

    def __init__(self, score):
        self.score = score

    def is_allergic_to(self, allergy):
        return bool(self.score & 1 << self._allergies.index(allergy))

    @property
    def lst(self):
        return [allergy for allergy in self._allergies
                if self.is_allergic_to(allergy)]

Version data entries

130 entries across 130 versions & 1 rubygems

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