okKANMANI okKANMANI - 3 months ago 15
Python Question

How to print without spaces in python 3?

>>> income = 50
>>> print("Your income tax is $",income,".")
Your income tax is $ 50 .


So how do I print "$ 50 ." together?

Answer

You can use the sep argument to print:

>>> income = 50000
>>> print("Your income tax is $", income, ".", sep='')
Your income tax is $50000.

Or use the str.format:

>>> print("Your income tax is ${}.".format(income))
Your income tax is $50000.
Comments