On the python track on solution
https://exercism.io/mentor/solutions/d5d94853c3144a00afff43803b093a9c
When I download the solution, there are lines missing which are present on the site.
downloaded with exercism client
class Allergies(object):
def __init__(self, score):
possible_allergies = ['eggs', 'peanuts', 'shellfish',
'strawberries', 'tomatoes', 'chocolate',
'pollen', 'cats']
# 1. Convert the score to a binary format.
self.score = bin(score)
# 2. Create a list for our patients allergies
self.contracted_allergies = []
# 3. Loop from the end of our score. 1 = allergy, 0 = no allergy
for i in range(len(self.score) - 1, 0, -1):
if self.score[i] == '1' and i > len(self.score) - 9:
index = len(self.score) - 1 - i
self.contracted_allergies.append(possible_allergies[index])
def is_allergic_to(self, item):
return item in self.contracted_allergies:
@property
def lst(self):
return self.contracted_allergies
visible in the UI :
class Allergies(object):
def __init__(self, score):
possible_allergies = ['eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats']
# 1. Convert the score to a binary format and then to a string, so that each digit has an index
self.score = str(bin(score))
# 2. Create a list for our patients allergies
self.contracted_allergies = []
# 3. Loop from the end of our score. 1 means that the person suffers from the allergy.
for i in range(len(self.score) - 1, 0, -1):
if self.score[i] == '1' and i > len(self.score) - 9:
index = len(self.score) - 1 - i
self.contracted_allergies.append(possible_allergies[index])
def is_allergic_to(self, item):
for x in self.contracted_allergies:
if x == item:
return True
return False
@property
def lst(self):
return self.contracted_allergies
there is only 1 iteration visible at the moment of logging this ticket.
On the python track on solution
https://exercism.io/mentor/solutions/d5d94853c3144a00afff43803b093a9c
When I download the solution, there are lines missing which are present on the site.
downloaded with exercism client
visible in the UI :
there is only 1 iteration visible at the moment of logging this ticket.