I was expecting the output to be “NaCl”, as it’s a molecules with 2 atoms (I think). This was my initial solution to the exercise:
class Atom:
def init(self, label):
self.label = label
def add(self, other):
return self.label + other.label
class Molecule:
def init(self, atoms):
if type(atoms) is list:
self.atoms = atoms
sodium = Atom(“Na”)
chlorine = Atom(“Cl”)
salt = Molecule([sodium, chlorine])
salt = sodium + chlorine
print(salt)
“NaCl” gets printed to the console. But this wasn’t the right answer. My question now is how is the answer presented by codecademy a molecule with 2 atoms?