How should I correct this ?
I suppose that you want to print out each element of the array "names" individually? If yes, then you should replace
print names by
print name. You can understand the for loop by reading the explanations on
Basically, the line
for name in names: is read as so: for every element "name" contained in the array "names" defined before, do something which is described hereunder. In this case, the command which is executed for every element in "names" is
print name. This will print every element "name" of the array, one after the other, iteratively.
But changing names to name won't solve the problem right ?
"name" and "names" are just variable names given by the user !
thanks for the help.