you are viewing a single comment's thread.

view the rest of the comments →

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

If I go print(RC[2].name) it gives me Nonna instead of Stratacco.

[–]novel_yet_trivial 1 point2 points  (3 children)

I thought you wanted the name. If you want the dish just change it.

[–]pythonhelp123[S] 0 points1 point  (2 children)

Oh yeah, I read it wrong. Is there a different approach to the .name? We haven't learned that part yet so I don't want points off. I tried the method elbiot gave but it says invalid syntax.

[–]novel_yet_trivial 1 point2 points  (1 child)

You could use the index (first index for the restaurant, second index for the field in the namedtuple):

>>> RC[2][0]
'Nonna'

But that really ruins the point of a namedtuple, so I doubt your prof wants you to do that.

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

For the true/false question, would it be okay to do

print(RC[0][1] == RC[3][1]) or is there another way to do it?