var_a = 8
var_b = 3
var_c = "hello my name is:",var_a,"and",var_b,"bye"
print(var_c)
When I run the program var_c gets printed out like this: ('hello my name is:', 8, 'and', 3, 'bye') but all the brackets etc get printed as well, why is this and is there a way to get rid of those symbols?
If I run the program like this:
print("hello my name is:",var_a,"and",var_b,"bye")
I don't have that problem
You can format your string to get your expected string output.
var_c = "hello my name is: {} and {}, bye".format(var_a, var_b)
As commented, your existing output is due to the variable being returned as a tuple, whereas you want it as one string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With