sorry if this is a duplicate thread but I couldn't find one.
I'm currently trying to make an inventory for a game that is in the works. The problem I run into is that, when you have a lot of a particular item, it kind of wastes a lot of space.
Here's my code: (inv is the inventory)
inv = ["item1","item2","item3","item2","item2","item1"]
print(', '.join(inventory))
Output:
item1, item2, item3, item2, item2, item1
I'd like to, instead of doing that, do this:
item1 x2, item2 x3, item3
I don't really care if you need item3 to be x1, either way would be fine, thanks.