0
I tried to make a program that accepts a list of elements and prints the sum of distinct elements from the list.What has gone wr
4 Answers
+ 4
I can't try the code, but if you want to just remove duplicates, use this:
j = list(set(j))
print(sum(j))
+ 2
SOUMYADEEP BISWAS don't try your code on sololearn, try it on a laptop, and see if it works or not
0
Yes but here the problem is i am getting one error output and one successful code compilation for
two different types of input
0
Aymane Boukrough i tried it on laptop but the results are same
The problem is that the code doesn't entirely fail to run.
Take two test cases:(number of elements in both cases is set to 5)
1)elements: 4,1,4,3,2
2)elements: 6,9,7,6,8
In first case program runs as it should but in 2nd case it ends with a errorlist index out of range