--

#2 is not right. This code does not print the same variable multiple times:

print(a*repeat)

It prints the result of calculating a*repeat.

If `a` is a string, the result looks like the string has been printed multiple times, but that isn't what isn't happening at all. For example, if the print statement had a `sep` argument, the result would not include the separator between the different "copies" of the string.

If `a` is anything other than a string, it won't do anything resembling printing the variable multiple times.

--

--

Martin McBride
Martin McBride

No responses yet