It’s really hard to know without seeing more of your blocks, such as what your list input looks like and what the variable “i” stands for. Can you explain what “i” is for here?
How have you verified that the two numbers you think about being added/subtracted/multiplied/divided are actually the two on the screen? Because I would check that before worrying about how to add/etc. them.
My initial guess is that your list contains text values, not numeric values. Especially if you are having the user type in an input as opposed to tapping a button.
My second thought is that maybe the order of the block assignment isn’t happening the way you’d expect it to. So you might try an intermediate step – at least for testing – where you assign a variable to the first number in the list, assign a variable to the second number in the list, and then finally add/etc. the two numbers.
Your result is consistent with starting from zero and then doing the operation. So adding works, but 6 - 1 is calculated as 0 -6 - 1, and multiplying is 0 * whatever, and dividing is 0 / 9 / 3.
I’d be looking for the glitch on your logic causing that - is the list starting out with a 0 in it? Or is your handling of the first number wrong?
Can you explain the logic of the = button. I got confused. Why there is a set of instructions when i = 0 and another set of instructions when i not equal ZERO?
That is because the ‘for loop’ is starting from 0. The list wouldn’t be able to get the 0th item of the list, so I’m starting from i+1(which is 1) if the i loop is in its first iteration.
I made this change and the numbers came correct.
starting the loop from 1
before the loop, store the first number in total so far variable. /your code is not taking care of the first number.