Depending on which classroom a pupil is in, I would like to return one of two values and assign it to the variable name 'scoreMutiplier' which would then be used later elsewhere in my code. However, I am still pretty new to this and have been confronted with the following error message after the first scenario when I execute my code: AttributeError: 'str' object has no attribute 'isin'
import numpy as np
pupil = 'Tom'
classroom_A = ['Peter', 'Greg', 'Susan', 'Tom', 'John']
classroom_B = ['Steve', 'Joe', 'Jose', 'Pam', 'Paul']
scenario = [((pupil.isin(classroom_A )) & (~pupil.isin(classroom_B ))),
((pupil.isin(classroom_B )) & (~pupil.isin(classroom_A )))]
result = [3,1]
scoreMultiplier = np.select(scenario , result, default='')
print(scoreMultiplier)
What is the best way to make this work?
Many thanks in advance.