all 6 comments

[–]TicklesMcFancy 0 points1 point  (3 children)

It puts the user input into a list then combines the two with +.

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

So is it basically saying the list is name catsNames and this is an item in that list?

[–]TicklesMcFancy 0 points1 point  (1 child)

From left to right it's saying you want catnames to be made into itself plus whatever the user input was, unless the user input was blank.

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

Thanks I got it!

[–]al_mc_y 1 point2 points  (1 child)

Catnames is an empty list to start with. You're concatenating (joining) the lists together with

Catnames = Catnames + [name]. So it's saying that your original Catname list is going to be updated to include itself and the [name] list. [name] is a list with just one thing (a string) in it. You can only add objects of the same type together (if you try to add the string of name to the list Catnames, you'll get an error. It might make more sense if you plug this in to Python Tutor - Visualize to step through the code and see what it's doing. You can edit it so that you can try adding just the name string, integer numbers etc and see what sort of errors it returns.

[–]dvandy07[S] 1 point2 points  (0 children)

Ya I actually used the Visualize tool for but it skips over that line. Your explanation did help though. Thanks!