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.
In this case ("11 y.o") you can use a "split"-method 'int(s.split()[0])'
But task is very specific (from 0 to 9).
Because the reply is coming as a string, and the condition is that first character is always a number. Thus you want only the first character exported from the given string.
could you explain why you use [0]?
nice! I solved it differently and it's interesting how you solve it
Yeah, but the description clearly says "first character will be the desired answer" so while your approach is more correct (or best practice) and solves wider problem, the task itself was much simpler in this case.
nice job
I also solved it.
This comment is hidden because it contains spoiler information about the solution
I have The same input. But this will not work on other type of strings like "i am 7 years".
No need for expansion.
The description already said 0-9 only required.
Code might not work for age >= 10. By using age[0], you are only obtaining the first index of the string, which in this case is the age, assumed to be less than 10. "Specification said it will be digit (0 through 9)." Make your code expandable!
Specification said it will be digit (0 through 9).
and what about e.g "11 years old"?