Python - List Functions Exercise | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Python - List Functions Exercise

This is my solution so far. Task: identify smallest and largest Elements of the list. Remove them and output sum of remaining elements. Test case is hidden. What am i missing? 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] index_max = data.index(max(data)) index_min = data.index(min(data)) n_max = data.count(data[index_max]) n_min = data.count(data[index_min]) for i in range(1,n_max): data.remove(data.index(max(data))) for i in range(1,n_min): data.remove(data.index(min(data))) print(sum(data))

28th Sep 2021, 2:52 PM
TraP kicK
TraP kicK - avatar
1 Resposta
+ 1
TraP kicK Here in a different way you can solve it. https://code.sololearn.com/cjLEHtmC9cGn/?ref=app
28th Sep 2021, 2:59 PM
AĶ¢J
AĶ¢J - avatar