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