1
print("The cost of paint based on whole gallons is: $", round(paint_costs,2))
The cost of paint based on whole gallons is: $ XXX.XX

How do I omit the space between the $ and amount so that it reads:

The cost of paint based on whole gallons is: $XXX.XX

Is it import.locale?

sithlorddahlia
  • 157
  • 1
  • 1
  • 11
  • in your case, using string formating is the correct answer: `"The cost of paint based on whole gallons is: ${0:.2f}".format(paint_costs)`. Don't use `round` to format numbers. – Daniel Feb 28 '15 at 13:38
  • If you think the solution has answered your problem, then please mark it as accepted. See http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Bhargav Rao Mar 04 '15 at 19:49

2 Answers2

1

Add sep="" parameter inside the print function.

print("The cost of paint based on whole gallons is: $", round(paint_costs,2), sep="")
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
1

Use the Py3 feature sep

print("The cost of paint based on whole gallons is: $", round(paint_costs,2),sep = "")

Other ways include

  • print("The cost of paint based on whole gallons is: ${}".format(round(paint_costs,2)))
  • print("The cost of paint based on whole gallons is: $%s"%(round(paint_costs,2)))
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140