Q:

Specifying an Item Separator in Python

I am new to programming in Python and using 2.7.5 version. I am running the following python statement 
monthly_pay = 5000.0
annual_pay = 12*monthly_pay
print 'Your annual pay is $',format(annual_pay,',.2f')

when I run it, there is a space between $ sign and the amount 60,000 and I don't want that space so I have tried to use 
monthly_pay = 5000.0
annual_pay = 12*monthly_pay
print ('Your annual pay is $',format(annual_pay,',.2f'), sep= ' ')

but shows an error on IDLE. I don't understand why. Can anybody help? 
Also I tried similar statements like 
print('One', 'Two', 'Three', sep='') but again as above it shows me an error

A:

In Python 2, you'll need to concatenate the strings yourself if you want to avoid a space:
print 'Your annual pay is $' + format(annual_pay, ',.2f')

The code you tried:
print('Your annual pay is $', format(annual_pay, ',.2f'), sep= ' ')

will work in Python 3, since print was turned into a function, and as such, can take keyword arguments (like sep), but since you're in Python 2, you have to go about it a different way.

