Python Forum
For Word, Count in List (Counts.Items())
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For Word, Count in List (Counts.Items())
#2
I don't think you need the call to list on line 12 - the view object that items returns is already something that can be iterated over.

list, though, is like dict. It creates an empty list when given no arguments, or turns its arguments into a list.

On point 2, bigcount is modified, on line 15.

It might help if you stepped through the code with pen and paper acting out what the computer would do. That should help you understand the code.
Reply


Messages In This Thread
RE: For Word, Count in List (Counts.Items()) - by ndc85430 - Jul-14-2022, 01:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting column of values into muliple columns of counts highland44 0 875 Feb-01-2024, 12:48 AM
Last Post: highland44
  Trying to get counts/sum/percentages from pandas similar to pivot table cubangt 6 3,227 Oct-06-2023, 04:32 PM
Last Post: cubangt
  Function to count words in a list up to and including Sam Oldman45 15 10,320 Sep-08-2023, 01:10 PM
Last Post: Pedroski55
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 2,828 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Finding combinations of list of items (30 or so) LynnS 1 1,495 Jan-25-2023, 02:57 PM
Last Post: deanhystad
  Row Count and coloumn count Yegor123 4 2,631 Oct-18-2022, 03:52 AM
Last Post: Yegor123
  Read All Emails from Outlook and add the word counts to a DataFrame sanaman_2000 0 2,712 Sep-15-2022, 07:32 AM
Last Post: sanaman_2000
  find some word in text list file and a bit change to them RolanRoll 3 2,338 Jun-27-2022, 01:36 AM
Last Post: RolanRoll
  How to get list of exactly 10 items? Mark17 1 3,606 May-26-2022, 01:37 PM
Last Post: Mark17
  How to get unique entries in a list and the count of occurrence james2009 5 4,126 May-08-2022, 04:34 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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