2 ms·
> If the data came in as length 1, the for loop would read the individual chars of the string. If it came in as >1 it would iterate through the list. You proba
by dist-epoch 3y ago
> If the data came in as length 1, the for loop would read the individual chars of the string. If it came in as >1 it would iterate through the list.
You probably did this:
for name in ("John"):
# "J"
# "o"
# "h"
# "n"
for name in ("John", "Sam"):
# "John"
# "Sam"
The correct form for the first one is this:
for name in ("John",):
# "John"