SpiceQA
Questions Tags Users Badges

I have to make a program that compares items in a list and counts how many instances it has without using the count() command. Then add it to a dict

Maggie 0
Created Sep 18, 2022 Edited Sep 18, 2022
Viewed 21

I have a program but the problem is I genuinely don't know how to make it count the instances of the inputted sentence without using count().

This is for an assignment.

So here I have a user inputting a sentence. After that I turn that sentence into a list with .split. Then I want to count all the instances of each word in the inputted sentence and turn that into a new list. Then I want to turn that into a dictionary using zip(). The problem is I don't know how to make it count the instances. I looked everywhere online but nothing helpful. I am not allowed to use count()

This is python3

count dictionary list loops python-3.x
Share
0 Answers
Related
Terms of service Privacy policy
Powered by Answer