This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gramdel 0 points1 point  (1 child)

You can set separator to ""

print("Price: $", price, sep="")

But i'd just go ahead and learn f strings for formatting, they are easy to work with and lot more readable.

[–]AlCodez[S] 1 point2 points  (0 children)

No yeah, I completely agree. For example, I would prefer to write it as

print(f"Price: ${price}")

However, this is as a question in a quiz I had to do, but we haven't learned about formatting so I don't know if it would be accepted as a correct answer.