0
{ANSWERED} Why is the answer different
data = [7, 5, 6.9, 1, 8, 42, 33, 128, 1024, 2, 8, 11, 0.4, 1024, 66, 809, 11, 8.9, 1.1, 3.42, 9, 100, 444, 78] data.remove (min(data)) data.remove (max(data)) i = 0 for a in data: i+=a. ((i+=1)) print (i) Why is it not the same answer when I do the thing in the double prentheses (i+=1)
5 Réponses
+ 3
[prenteces = parentheses]
The variable, a, represents each value stored in the data array. After the loop is done, i will hold the sum of all the values within data added together.
If you replace a with 1, then i will increment by 1 for each element in the data array. After the loop, i will hold a count of the elements in data.
+ 1
Brian
No sour if i understood
With ‘a’ list [‘132’ ‘32’]== 164
With ‘1’ list [‘132’ ‘32’]==2
Please let me know if i understood if not please speak bigginer languege since im a bigginer
+ 1
Lz1234 yes, your answer shows a good understanding.
0
Pls save the code as public in Code Playground and include a link to it in the question.
The statement in double parenthesis change "i" value. So, obviously, changes the answer. What's the question?
0
Emerson Prado
The quesion was answered already look at checked one