Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minimum size
#2
(Jul-08-2019, 09:14 PM)Amniote Wrote: mylen = lambda s: s.count(' ') + 1

What's your intention with that line?
There's no spaces in any of your values, so counting how many blank spaces there are will always give zero. So getting the min value will always return 1, since the min is 0+1. So all of them are printed, because all of them have the same min (because none of them have spaces in them).
Reply


Messages In This Thread
Minimum size - by Amniote - Jul-08-2019, 09:14 PM
RE: Minimum size - by nilamo - Jul-08-2019, 09:18 PM
RE: Minimum size - by Amniote - Jul-08-2019, 10:19 PM
RE: Minimum size - by Gribouillis - Jul-08-2019, 09:32 PM
RE: Minimum size - by Gribouillis - Jul-09-2019, 06:37 AM
RE: Minimum size - by perfringo - Jul-09-2019, 06:58 AM
RE: Minimum size - by Amniote - Jul-09-2019, 07:49 AM
RE: Minimum size - by perfringo - Jul-09-2019, 09:00 AM
RE: Minimum size - by nilamo - Jul-10-2019, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to get indices of minimum time difference Mekala 1 2,256 Nov-10-2020, 11:09 PM
Last Post: deanhystad
  How to get index of minimum element between 3 & 8 in list Mekala 2 2,653 Nov-10-2020, 12:56 PM
Last Post: DeaD_EyE
  Finding MINIMUM number in a random list is not working Mona 5 3,223 Nov-18-2019, 07:27 PM
Last Post: ThomasL
  Delete minimum occurence in a string RavCOder 10 4,214 Nov-12-2019, 01:08 PM
Last Post: RavCOder
  size of set vs size of dict zweb 0 2,223 Oct-11-2019, 01:32 AM
Last Post: zweb
  Armstrong in minimum lines Gaurav 1 2,080 Sep-03-2018, 03:46 PM
Last Post: j.crater
  Watson Personality Insight: minimum number of words kiton 0 2,844 Apr-28-2018, 03:28 PM
Last Post: kiton
  CSV file created is huge in size. How to reduce the size? pramoddsrb 0 10,617 Apr-26-2018, 12:38 AM
Last Post: pramoddsrb
  Python find the minimum length of string to differentiate dictionary items zydjohn 3 3,798 Mar-03-2018, 05:23 PM
Last Post: Gribouillis
  Product of maximum in first array and minimum in second Thethispointer 9 5,585 Jan-19-2018, 07:38 PM
Last Post: Thethispointer

Forum Jump:

User Panel Messages

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