Python Forum
Computer science can you help me with the last part of the code after mentionedWords.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Computer science can you help me with the last part of the code after mentionedWords.
#3
@perfringo

I assumed it was correct bc my professor gave me changes and that was the only part left I needed to write. I guess you could be right.

Task Step-by-step:

Modify function cleanedup so that it keeps not only letters, but also digits 0123456789 and symbols @ and _

Write a new function findMentions that takes a filename as a parameter and reports 3 usernames most frequently mentioned in that file. The function should create a dictionary of counts for all username mentions (words starting with @). After reading through the file and accumulating the counts for all mentioned usernames, use the dictionary to create a list like this:

[[15, '@alice'], [20, '@bob'], [7, '@carol'], ... ]

Use sort to sort the above list and print out 3 most frequently mentioned usernames.

Check each file in the current folder (using os.listdir('.')), if the file name ends with .tweets, call findMentions on the file to find its most frequent mentions.
Reply


Messages In This Thread
RE: Computer science can you help me with the last part of the code after mentionedWords. - by shirleylam852 - Nov-27-2020, 06:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Having trouble with my Computer Science task Dunxx 1 1,881 Oct-07-2021, 12:32 PM
Last Post: DeaD_EyE
  computer science coursework, read the text please and tell me if theres any specifics sixcray 4 2,800 Nov-11-2020, 03:17 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020