Back to General discussions forum
The program counts correctly. I do not understand how to put brackets correctly
out1.extend(['(',str(d3),str(h3),str(m3),str(s3),')'])
print(' '.join(out1))
Please sorry for delay, I didn't at once understand the question.
I see now you have problem solved already by using something like
print('('+str(d3),str(h3),str(m3),str(s3)+') ')
That's very good!
I can only add that sometimes the string template can be used in such cases:
result = "(%s %s %s %s)" % (d3, h3, m3, s3)
You see, we form template just as we want result string to look like - but put %s
in places where values should be.
Then we pass values in a tuple, after %
operator. If there is only one value, it can be passed without tuple.
Thanks for the help. Your template is more effective