naxsg.blogg.se

Typeitin 2.6.1 program programs
Typeitin 2.6.1 program programs












typeitin 2.6.1 program programs

You could instead do this using a dictionary with the key being a word and the value being the count for that word. I am quite new to programming so please try and do it in the most barebones fashion. Words_to_count = (word for word in word_list if word.isupper()) In Python 2.7 and above there is a class called Counter which can help you: from collections import Counter count how many times each word in uniquewords appears in the original list.delete the first word and all its duplicated from original list.add the new first word into unique words.delete the first word and all its duplicated from the original list.put the first word in the list into another list called uniquewords.I am sure there is a better way than this, but my idea was to do the following: However I am only looking to find the top three that have the first letter capitalized and ignore all words that do not have the first letter capitalized. I am trying to count how many times each word appears and display the top 3. Given the following list ['Jellicle', 'Cats', 'are', 'black', 'and', 'white,', 'Jellicle', 'Cats', Original close reason(s) were not resolved The community reviewed whether to reopen this question 6 months ago and left it closed:














Typeitin 2.6.1 program programs