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.98 tracks/python/exercises/allergies/example.py
trackler-2.2.1.97 tracks/python/exercises/allergies/example.py
trackler-2.2.1.96 tracks/python/exercises/allergies/example.py
trackler-2.2.1.95 tracks/python/exercises/allergies/example.py
trackler-2.2.1.94 tracks/python/exercises/allergies/example.py
trackler-2.2.1.93 tracks/python/exercises/allergies/example.py
trackler-2.2.1.92 tracks/python/exercises/allergies/example.py
trackler-2.2.1.91 tracks/python/exercises/allergies/example.py
trackler-2.2.1.90 tracks/python/exercises/allergies/example.py
trackler-2.2.1.89 tracks/python/exercises/allergies/example.py
trackler-2.2.1.88 tracks/python/exercises/allergies/example.py
trackler-2.2.1.87 tracks/python/exercises/allergies/example.py
trackler-2.2.1.86 tracks/python/exercises/allergies/example.py
trackler-2.2.1.85 tracks/python/exercises/allergies/example.py
trackler-2.2.1.84 tracks/python/exercises/allergies/example.py
trackler-2.2.1.83 tracks/python/exercises/allergies/example.py
trackler-2.2.1.82 tracks/python/exercises/allergies/example.py
trackler-2.2.1.81 tracks/python/exercises/allergies/example.py
trackler-2.2.1.80 tracks/python/exercises/allergies/example.py
trackler-2.2.1.79 tracks/python/exercises/allergies/example.py