I'd wish to have this challenge posted on my blog but because I suck in
IT english, could you guys help me with decribing the task of what the
code supposed to do?
--
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
On 19/01/2021 10:42, Bischoop wrote:
On 2021-01-19, Peter Otten <__pete...@web.de> wrote:
On 19/01/2021 04:45, Bischoop wrote:
I sat to it again and solved it.
Congratulations!
lil = tuple(set(s)) # list of characters in s
li=[0,0,0,0,0,0] # list for counted repeats
I see a minor probl
On 2021-01-19, Peter Otten <__pete...@web.de> wrote:
> On 19/01/2021 04:45, Bischoop wrote:
>
>> I sat to it again and solved it.
>
> Congratulations!
>
> > lil = tuple(set(s)) # list of characters in s
> >
> > li=[0,0,0,0,0,0] # list for counted repeats
>
> I see a minor problem here. What happen
On 19/01/2021 04:45, Bischoop wrote:
I sat to it again and solved it.
Congratulations!
> lil = tuple(set(s)) # list of characters in s
>
> li=[0,0,0,0,0,0] # list for counted repeats
I see a minor problem here. What happens if s contains more than len(li)
characters?
import timeit
Since
On 2021-01-14, Stefan Ram wrote:
>
> If you want to know why, maybe you should insert print
> statements to see the values of critical variables and
> expression, especially in loops.
>
> Then compare the printed values with your expectations.
>
> Also, decompose into meaningful functio
On 17/01/2021 02:15, Dan Stromberg wrote:
IMO a good set of tests is much more important than type annotations ;)
def get_longest(string: str) -> typing.Tuple[int, typing.List[str]]:
"""Get the longest run of a single consecutive character."""
May I ask why you artificially limit th
On Thu, Jan 14, 2021 at 2:01 PM Wolfram Hinderer via Python-list <
python-list@python.org> wrote:
> Am 13.01.2021 um 22:20 schrieb Bischoop:
> > I want to to display a number or an alphabet which appears mostly
> > consecutive in a given string or numbers or both
> > Examples
> > s= ' aabskaaabad
On 2021-01-16 03:32, Bischoop wrote:
>> The OP didn't specify what should happen in that case, so it would
>> need some clarification.
>
> In that case maybe good solution would be to return three of them?
That's the solution I chose in my initial reply, you get a tuple back
of ([list of longest
On 2021-01-14, Tim Chase wrote:
>
> seems to only return one value so seems to get odd results if I
> specify something like
>
> get_longest("aaabcccbbb")
>
> which at least here tells me that "c" is the longest run, even though
> aaa, bbb, and ccc are all runs of length 3. The OP didn't specif
Am 13.01.2021 um 22:20 schrieb Bischoop:
I want to to display a number or an alphabet which appears mostly
consecutive in a given string or numbers or both
Examples
s= ' aabskaaabad'
output: c
# c appears 4 consecutive times
8bbakebaoa
output: b
#b appears 2 consecutive times
You can
On 2021-01-13, Bischoop wrote:
I know what was wrong:
> m = s.index(i)
I forgot that m will return first index of i.
So tried that way but still getting out of index although I that that
I'm making sure not to get out of index.
s = 'aabskaaabadh'
c = 0
t = list(set(s)) # list
On Wed, Jan 13, 2021 at 6:20 PM Dan Stromberg wrote:
> On Wed, Jan 13, 2021 at 5:59 PM Tim Chase
> wrote:
>
>> On 2021-01-13 21:20, Bischoop wrote:
>> > I want to to display a number or an alphabet which appears mostly
>> > consecutive in a given string or numbers or both
>> > Examples
>> > s=
On 2021-01-13 18:20, Dan Stromberg wrote:
> I'm kind of partial to:
>
> import collections
> import typing
>
>
> def get_longest(string: str) -> typing.Tuple[int, str]:
> """Get the longest run of a single consecutive character."""
> dict_: typing.DefaultDict[str, int] =
> collections.de
On Wed, Jan 13, 2021 at 5:59 PM Tim Chase
wrote:
> On 2021-01-13 21:20, Bischoop wrote:
> > I want to to display a number or an alphabet which appears mostly
> > consecutive in a given string or numbers or both
> > Examples
> > s= ' aabskaaabad'
> > output: c
> > # c appears 4 consecutive ti
On 2021-01-13 21:20, Bischoop wrote:
> I want to to display a number or an alphabet which appears mostly
> consecutive in a given string or numbers or both
> Examples
> s= ' aabskaaabad'
> output: c
> # c appears 4 consecutive times
> 8bbakebaoa
> output: b
> #b appears 2 consecutive times
I
On 2021-01-13, Bischoop wrote:
> t = set(s) # set of characters in s
I have this one changed to:
t= list(set(s))
--
https://mail.python.org/mailman/listinfo/python-list
I want to to display a number or an alphabet which appears mostly
consecutive in a given string or numbers or both
Examples
s= ' aabskaaabad'
output: c
# c appears 4 consecutive times
8bbakebaoa
output: b
#b appears 2 consecutive times
I thought about set the string then and for each element
17 matches
Mail list logo