I've learnt from this question that it is possible to join the values in an array using ", ".join(var)
in Python. This code works for strings, for example:
var = ["hello","world"]
print (", ".join(var))
Gives an output of hello, world
which is what I want.
However, when I use numbers in the array:
var = [1,2,3]
print (", ".join(var))
It gives an error message:
Traceback (most recent call last):
File "C:\path\test.py", line 2, in <module>
print (", ".join(var))
TypeError: sequence item 0: expected str instance, int found
Whereas, I want the output to be:
1, 2, 3
Is there another way I can this so it will print all of the numbers and also have the ability to be increased so I can have any amount of numbers?