In the exercise 9, in the exercises type range(), there is a part where you need a mathematical formula that you may not know. When i looked at the solution of the exercise (http://www.mclibre.org/consultar/python/ejercicios/ej_range_soluciones.html), i found:
inicial2=inicial//paso*paso+paso
Ok, but... what the hell was that??
To understand it, searched it for all over the web and after hours searching for it, i got tired because of the lack of positive results and I decided to take a paper and a pen and start doing the best thing I can do: thinking.
After two hours in front of a paper, I found the solution: The test to know if you have solved good the division!!!
I found a relation between that strange formula and the test of the division:
inicial//paso*paso+paso <=> D//d*c+c (Dividend/divisor*cocient+cocient)
That's where that formula comes from, in case that you are interested on it. Else, you may just need the formula to solve the problem. This entry of this blog is only to curious people like me who want to understand this better, like me.
If you still don't understand it well and you want to understand it better, you can ask it in the comments and i'll try to explain it the best i can!
No hay comentarios:
Publicar un comentario