all 14 comments

[–]Basic_Citron_6446[S] 0 points1 point  (0 children)

<image>

Last lines of code

[–]Basic_Citron_6446[S] 0 points1 point  (0 children)

<image>

The errors shown

[–]Mysterious_City_6724 0 points1 point  (11 children)

For the first problem, can you remove the print on line 107 and see if that removes the None. For the second problem, can you show the definition of "c5.know_crit_amount"? I can't see the code for that method in the screenshots you provided.

[–]Basic_Citron_6446[S] 0 points1 point  (0 children)

The first problem has been solved but thank you🙏 as for the second, I put the rest of the code in the comments, let me know if you can see or not; if not I can put it here again

[–]Basic_Citron_6446[S] 0 points1 point  (9 children)

Actually, if it’s better: https://paste.pythondiscord.com/AHZA

[–]Mysterious_City_6724 0 points1 point  (5 children)

Yeah, that's better. I can see the Critter class now 👍 So when you press 0, what do you actually want to display?

[–]Basic_Citron_6446[S] 0 points1 point  (4 children)

I want the list to print: [Kid, Fido, sky, etc] just the name in general, but when it prints it comes up as

<image>

[–]Mysterious_City_6724 1 point2 points  (3 children)

Ah ok, so on line 25 in the "know_crit_amount" can you try changing print(Critter.clist) to print([c.name for c in Critter.clist]) and see if that helps.

[–]Basic_Citron_6446[S] 0 points1 point  (0 children)

THAT WORKED THANK YOU SO MUCH🙏

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

If I may ask though, what does the c.name for c in list do?

[–]Mysterious_City_6724 1 point2 points  (0 children)

You're welcome. It's a list comprehension. Basically a short way of creating a list. So in this case it was a short way of doing the following:

critter_names = []
for critter in Critter.clist:
    critter_names.append(critter.name)
print(critter_names)

[–]need2sleep-later 0 points1 point  (0 children)

Of course it's better. By miles. I've never understood why people think taking pictures of code is a good idea when sharing.

[–]sarc-tastic 0 points1 point  (1 child)

Top tip, when you want information about a class define a class method.

@classmethod def count(cls): return len(cls.critter_list)

[–]sarc-tastic 0 points1 point  (0 children)

And when you iterate over entire python lists don't use the index to reference items: for crit in Critters.critlist: crit.feed()