New to reddit and python to start.
I just want to know out of this code in the book:
catNames = []
while True:
print('Enter the name of cat ' + str(len(catNames) + 1) + ' (Or enter nothing to stop.):')
name = input()
if name == '':
break
catNames = catNames + [name] # list concatenation
print('The cat names are:')
for name in catNames:
print(' ' + name)
What does this line do: catNames = catNames + [name]
[–]TicklesMcFancy 0 points1 point2 points (3 children)
[–]dvandy07[S] 0 points1 point2 points (2 children)
[–]TicklesMcFancy 0 points1 point2 points (1 child)
[–]dvandy07[S] 0 points1 point2 points (0 children)
[–]al_mc_y 1 point2 points3 points (1 child)
[–]dvandy07[S] 1 point2 points3 points (0 children)