Personally I used CodeCademy to learn the basics and rely on W3Schools to get a reminder of the correct syntax to use when I am not sure. Do not hesitate to Google what you are trying to achieve if you suspect that something already exists to do so in Python's built-in methods. I cannot speak for everyone there but this is what worked best for me so maybe it will suit your learning style as well !
Just as I clicked submit, I envivisioned (as I usually do) what the one line solution would look like and just as I thought of abs(), here it is. Dammit.
I submitted the solution above and one slightly refactored variation 9 years ago. I definitely did not copy from StackOverflow and I claim my solution original. I have no idea how a number of people came up with the exact solution of mine. Note that you can see other solutions once you solved a kata. Interestingly many of the accounts above where suspended.
.count() is a string method.
to find the methods list of each class(string is a class)
type in python:
dir(string)
it will give you the list of all available methods for that particular class
this is clean but it takes the longest to run the tests out of the other 2 i've tried (both are other popular solutions)
Personally I used CodeCademy to learn the basics and rely on W3Schools to get a reminder of the correct syntax to use when I am not sure. Do not hesitate to Google what you are trying to achieve if you suspect that something already exists to do so in Python's built-in methods. I cannot speak for everyone there but this is what worked best for me so maybe it will suit your learning style as well !
very nice!
Hey it could be worst, i know how to use it and still used it wrong .-.
how do you actually know all of this stuff
Wow
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Just as I clicked submit, I envivisioned (as I usually do) what the one line solution would look like and just as I thought of abs(), here it is. Dammit.
Poor guy, lol
I submitted the solution above and one slightly refactored variation 9 years ago. I definitely did not copy from StackOverflow and I claim my solution original. I have no idea how a number of people came up with the exact solution of mine. Note that you can see other solutions once you solved a kata. Interestingly many of the accounts above where suspended.
I mean runtime because of an additional function call.
solutions were copy pasted from the internet (stackoverflow) probably.
What do you mean by expensive? As in it takes a lot of system resources compared to over operations?
Loading more items...