Sha256: 28473c6f08666cd6a9b1f8405d02ef244601c91f682f81d551d83797ad0d81d5

Contents?: true

Size: 498 Bytes

Versions: 119

Compression:

Stored size: 498 Bytes

Contents

class Allergies:

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

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

    def is_allergic_to(self, allergy):
        return 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

119 entries across 119 versions & 1 rubygems

Version Path
trackler-2.0.6.3 tracks/python/exercises/allergies/example.py
trackler-2.0.6.2 tracks/python/exercises/allergies/example.py
trackler-2.0.6.1 tracks/python/exercises/allergies/example.py
trackler-2.0.6.0 tracks/python/exercises/allergies/example.py
trackler-2.0.5.18 tracks/python/exercises/allergies/example.py
trackler-2.0.5.17 tracks/python/exercises/allergies/example.py
trackler-2.0.5.16 tracks/python/exercises/allergies/example.py
trackler-2.0.5.15 tracks/python/exercises/allergies/example.py
trackler-2.0.5.14 tracks/python/exercises/allergies/example.py
trackler-2.0.5.13 tracks/python/exercises/allergies/example.py
trackler-2.0.5.12 tracks/python/exercises/allergies/example.py
trackler-2.0.5.11 tracks/python/exercises/allergies/example.py
trackler-2.0.5.10 tracks/python/exercises/allergies/example.py
trackler-2.0.5.9 tracks/python/exercises/allergies/example.py
trackler-2.0.5.8 tracks/python/exercises/allergies/example.py
trackler-2.0.5.7 tracks/python/exercises/allergies/example.py
trackler-2.0.5.6 tracks/python/exercises/allergies/example.py
trackler-2.0.5.5 tracks/python/exercises/allergies/example.py
trackler-2.0.5.4 tracks/python/exercises/allergies/example.py
trackler-2.0.5.3 tracks/python/exercises/allergies/example.py