0

I'm trying to create a list of classes that have an element name that I can later iterate through based on user input. My problem is that whenever I try to simply print what's entered into my 'elementList' list, I get a memory location instead of the '1', '1', 'hydrogen' etc. like I hoped for.

class ElementInformation:
# create the element function

    def __init__(self, atomicnumber, atomicweight, elementname, elementsymbol, meltingpoint, boilingpoint):

        self.atomicNumber = atomicnumber
        self.atomicWeight = atomicweight
        self.elementName = elementname
        self.elementSymbol = elementsymbol
        self.meltingPoint = meltingpoint
        self.boilingPoint = boilingpoint


elementList = []
elementList.append(ElementInformation("1", "1", "Hydrogen", "H", "-434", "-432"))
print(elementList[0])
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

0 Answers0