Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
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
ohhh because strsplit will make double level list .must [[1]] is ok
Not in Python 2, this solution is at least 6 years old.
This comment is hidden because it contains spoiler information about the solution
Added for all languages
Not a issue, you simply have to convert your input.
https://www.geeksforgeeks.org/whats-difference-between-char-s-and-char-s-in-c/
I am wrong in the previous comment.
According to geeksforgeeks, read-only memory is located in code section of memory, and the array which was passed as a parameter is located in stack section of memory. Sorry for missleading!
I think,
char *s = "something";
will create the string in read-only memory section.
But if we pass char * as a parameter in a function, it is just a char type pointer so that it can access and operate char type array which is string which is located in the code section in memory.
There are a few conditions to meet, afaik, for that to work:
Not the current case tho.
Right and what did you mean to do with '-'
Never mind whether that's why your code fails. Start with with whether that's what you meant!
If a char is less than 0, then what is it, and what should you do with it? For example, what is 36? And what should be done with that?
Or, what values smaller than 48 do you find when you carry this out. Where do those come from, what are they, how should they be treated when summing digits?
Your code and what you think your code does is very disconnected. You need to re-evaluate what it does, what you meant. Maybe use print to observe step by step what happens.
Can you describe in english what your if-statement (in the for-loop) tests for?
And, can you describe in english what your code does in both those cases?
I don't think you'll be able to match up your code to how you would describe to another person how to add digits of a number.
Loading more items...