I wanted to know how I can print the quantity of the items in a list in Python. For example:
list1 = ["hello", "goodbye", "hello"]
message = ", ".join(list1)
print(message)
I would like my output to be "2x hello, 1x goodbye". I have not found any library that does something like that, but I just started coding so I might be missing something. If you know any library that does this or if you have any clue on how I could do it, I am open to any advice.
Thank you in advance!
Edit: thank you all for the big help. All the answers were useful and solved the problem.