'str' object is not callable?


#1

I’m new to python and I can’t find the error!

Error Message: Traceback (most recent call last):
File “/home/myles/Desktop/LearningPython/oop4.py”, line 56, in
myl3_1.print_myl()
File “/home/myles/Desktop/LearningPython/oop4.py”, line 45, in print_myl
print("–>", myl.fullname())
TypeError: ‘str’ object is not callable

class myles1:
    raise_amt = 1.04

    def __init__(self, first, last, pay):
        self.fullname = first + " " + last
        self.first = first
        self.last = last
        self.email = first + "." + last + "@" + "powbow.com"
        self.pay = pay

    def fullname(self):
        return "{} {}".format(self.first, self.last)

    def apply_raise(self):        self.pay = int(self.pay * self.raise_amt)
    pass


class myles2(myles1):
    raise_amt = 1.10

    def __init__(self, first, last, pay, ProgLang):
        super().__init__(first, last, pay)
        self.ProgLang = ProgLang


class myles3(myles1):

    def __init__(self, first, last, pay, myles1s=None):
        super().__init__(first, last, pay)
        if myles1s is None:
            self.myles1s = []
        else:
            self.myles1s = myles1s

    def add_myl(self, myl):
        if myl not in self.myles1s:
            self.myles1s.append(myl)

    def remove_myl(self, myl):
        if myl in self.myles1s:
            self.myles1s.remobe(myl)

    def print_myl(self):
        for myl in self.myles1s:
            print("-->", myl.fullname())


myl2_1 = myles2("Corey", "Schafer", 1230, "Python")
myl2_2 = myles2("Corey1", "Schafer1", 13230, "Java")

myl3_1 = myles3("bob", "bobson", "1500", [myl2_1])

myl3_1.print_myl()

#2

wow I’m a dumbo, I removed : self.fullname = first + " " + last and it’s working it must have been interfering with the “def fullname”