def my_function(fname):
print(fname + " Refsnes")
my_function("Emil")
my_function("Tobias")
my_function("Linus")
def my_greeting(*fname):
print(fname + " Smith")
my_greeting("Don")
The first part runs fine the second part crashes. Here are the results.
Emil Refsnes
Tobias Refsnes
Linus Refsnes
Traceback (most recent call last):
File "C:/Data/Python/turtleFun/kikiFunction.py", line 19, in <module>
my_greeting("Don")
File "C:/Data/Python/turtleFun/kikiFunction.py", line 17, in my_greeting
print(fname + " Smith")
TypeError: can only concatenate tuple (not "str") to tuple
I haven't created a tuple, I'm not trying to concatenate. The structures are the same but one runs and the other crashes. Why does Python 3.8.3 think I have a tuple? How do I fix? Tuples would be
myTuple = ("Don", "Fred", "George", "Paul", "John", "Ringo")