0

Cómo puedo simplificar esto? / How can I simplify this?

Este ejercicio 44.2 de la versión Pro ya esta correctamente resuelto, pero me gustaría saber cómo podría simplificar la parte de la función en la que se ponen las distintas multiplicaciones, en vez de escribirlas una a una. / This exercise 44.2 of the Pro version is already correctly solved, but I would like to know how I could simplify the part of the function in which the different multiplications are put, instead of writing them one by one. https://code.sololearn.com/coOVAJWoKQ3G/?ref=app

21st Sep 2021, 5:38 PM
Guillermo Ulises
2 odpowiedzi
+ 2
You can do this with a for loop. With step = n. A little bit tricky is to find out the right start value. Because "n" based on the natural cout (1,2,3...), but the arrays index is zero based (0,1,2...) I've made an example. Maybe you will find out how it works. https://code.sololearn.com/cLYoa59EfR0M/?ref=app
21st Sep 2021, 6:35 PM
Coding Cat
Coding Cat - avatar
+ 1
wow! Thank you very much, I was overthinking, when in fact it was so simple and clean.
21st Sep 2021, 7:18 PM
Guillermo Ulises