Nice. My answer is similar but I have an additional check before the for loop to filter out 2 scenarios, as to me it seems a waste of compute to loop over them. Interested to know if anyone thinks my approach is good practice.
How bad is that? Specify iterable instead of list ( the output format currently isn't even specified ), and you allow for ( modern ) idiomatic solutions.
Bc If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match. So, u get a RE object or None, but we need a bool type as an answer.
You can read more here: https://docs.python.org/3/library/re.html
Nice. My answer is similar but I have an additional check before the for loop to filter out 2 scenarios, as to me it seems a waste of compute to loop over them. Interested to know if anyone thinks my approach is good practice.
I Think this is a really good solution
How bad is that? Specify
iterable
instead oflist
( the output format currently isn't even specified ), and you allow for ( modern ) idiomatic solutions.I will always opt for a readable solution to a one line complex one
how you change input name and get away with it
Awful description, I was like WTF?
Are you on macOS? I suspect that this is a distribution problem. I think macOS has a differentecho
then GNU/Linux.echo
is a built-in command, so it's the fault of the built-in bash being too old. This should work with newer bash.This comment is hidden because it contains spoiler information about the solution
Bc If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match. So, u get a RE object or None, but we need a bool type as an answer.
You can read more here: https://docs.python.org/3/library/re.html
Is this a GNU extension?
This comment is hidden because it contains spoiler information about the solution
I have exacly the same
I thought this would cause an IndexError or something?
ohhh because strsplit will make double level list .must [[1]] is ok
Hi! What does
[[1]]
mean please?Loading more items...