Desired output 1:
Let's say I have a list like this:
my_list = ['car', 'car', 'truck', 'van', 'car', 'truck', 'van']
I have three cars, two vans and two trucks. Is there a way to print the output of the items of the list like this:
3 cars
2 trucks
2 vans
Desired output 2:
And is there another method to remove the number of cars the user says like:
How many cars do you want to remove?: 2
1 car
2 trucks
2 vans
These are my questions. How can I do this in Python using the least amount of code?
I agree there is a duplicate of this question but those don't explain how I can delete the items from my list upon user input.