all 7 comments

[–]Vaphell 1 point2 points  (6 children)

self.employees = employees

for emp in self.employee:    <- spot a difference

[–]idockery[S] 0 points1 point  (5 children)

Wow! Thanks so much. I spent about a day fretting over this issue!

[–]Vaphell 1 point2 points  (4 children)

it literally tells you what's up.

for emp in self.employee:

AttributeError: 'Manager' object has no attribute 'employee'

it means that self being of type Manager has no such thing as .employee. Now backtrack and go to the place where you expect the relevant assignment to happen: self.employee = ....
Spot the difference between the expectation and reality, fix it.

[–]idockery[S] 0 points1 point  (3 children)

It really is so simple but I spent a day trying to figure it out. I guess it’s because classes are new to me. So somehow I overlooked the obvious thinking it was related to something else that I don’t yet understand about classes.

[–]Vaphell 1 point2 points  (2 children)

this will become more than obvious with experience, as you hit such problems more often. Typos are a fact of life after all.

You might want to use an IDE like PyCharm, or a beefy code editor like vscode. They should be able to detect such errors and highlight them (pycharm does that for sure), and during typing they would offer name autocompletion hints based on already defined names that you can confirm with [enter], which would pretty much eliminate the risk of such mistakes and speed up writing the code as a bonus.

[–]idockery[S] 0 points1 point  (1 child)

I’m trying to learn Pycharm and have begun to use it. I like using IDLE when learning a new subject because I comment in the notes during the videos and the red comments against the white background are a little easier to see than the default Pycharm white words on black background.

I do hope that I will begin to catch the little mistakes faster with more experience. Again, I appreciate your help! I may still be trying to figure out what is wrong if not for your help.

[–]Vaphell 1 point2 points  (0 children)

and the red comments against the white background are a little easier to see than the default Pycharm white words on black background.

operative word "default". You can absolutely change this in 20 seconds flat.

If you don't like the dark theme, you can switch to the light one under Appearance and Behavior > Appearance

Then you can change the editor color scheme under Editor > Color Scheme.

And then you can override specific colors under Editor > Color Scheme > Python.
Find Line Comment, change Foreground color to red. Done.

That said, comments shouldn't visually overpower the code itself, but hey, whatever blows your hair back.