+ 1
Rangesum R Problem
I've been stuck for a few days with the rangeSum() problem in the R course. No matter what I write, I can't seem to get the answer right. Any help is welcome. Thanks!
5 Antworten
+ 3
Don't reassign the iterator variable i in the loop!
And only print the sum once after the loop (not inside the loop)
+ 2
Please show your code! Then we can help you to solve it
+ 2
Gonzalo Rodríguez Hermida I completed that challenge. Show us your code so far and we will help you.
I will give you a hint. I used a for loop...
for(n in a:b)
+ 1
This is my code so far. I can't seem to make it not print all the other sums, apart from the message Error in rangeSum(x, y) : could not find function "rangeSum" popping up constantly
sum = 0
for (i in x:y) {
sum = sum+i
i = x
print(sum)
}
0
Thank you very much!!!