The syntax error is because you're using both the +
and %
operators in a row. When you use %
for string formatting, you don't want +
in between the format string and its arguments.
So, the most basic fix would be to get rid of the extra +
characters:
print ('%0.2f' % userUSD + '= %0.2f' % Euro + 'Euro')
However, it would probably make more sense to combine the format strings together, and do just one formatting operation:
print('%0.2f = %0.2f Euro' % (userUSD, Euro))
In new code though it's generally recommended to use the more capable str.format
formatting system, rather than the %
operator:
print('{:.2f} = {:.2f} Euro'.format(userUSD, Euro))