продолжаеться война со списками, мне нужны только некоторые елементы со списка
мой список: SORTED [[[0.391, ‘J’], [0.366, ‘J’], [0.299, ‘7’], [0.234, ‘8’], [0.269, ‘8’], [0.239, ‘R’], [0.3, ‘K’], 2.098], [[0.384, ‘J’], [0.387, ‘J’], [0.282, ‘7’], [0.239, ‘8’], [0.25, ‘8’], [0.256, ‘R’], [0.357, ‘K’], 2.155], [[0.391, ‘J’], [0.379, ‘J’], [0.458, ‘7’], [0.235, ‘8’], [0.289, ‘8’], [0.275, ‘R’], [0.378, ‘K’], 2.4050000000000002], [[0.401, ‘J’], [0.462, ‘7’], [0.422, ‘J’], [0.287, ‘8’], [0.271, ‘8’], [0.286, ‘R’], [0.377, ‘K’], 2.5060000000000002], [[0.382, ‘J’], [0.35, ‘J’], [0.517, ‘7’], [0.36, ‘8’], [0.259, ‘8’], [0.331, ‘R’], [0.36, ‘K’], 2.5589999999999997], [[0.389, ‘J’], [0.348, ‘J’], [0.499, ‘7’], [0.369, ‘8’], [0.365, ‘8’], [0.289, ‘R’], [0.342, ‘K’], 2.601], [[0.352, ‘J’], [0.36, ‘J’], [0.627, ‘7’], [0.412, ‘8’], [0.258, ‘8’], [0.317, ‘R’], [0.383, ‘K’], 2.709]] по сути это список списков, и мне нужны с него буквы и последнее значение Примерно вот так: [[‘J’], [‘J’], [‘7’], [‘8’], [‘8’], [‘R’], [‘K’], 2.098], etc. Заранее спасибо! сам код списка:
def Sort(listy):
for index in listy:
l = len(listy) for i in range(0, l): #for j in range(0, l): for j in range(0, l-i-1): if (listy[j][-1] > listy[j+ 1][-1]): temp = listy[j] listy[j]= listy[j + 1] listy[j + 1]= temp return listy
print(Sort(listy))
sortedlist = Sort(listy)
print("SORTED", sortedlist)
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.Do you like it? Share on social networks!
- Akiv Doros
- Nov. 11, 2024, 2:58 p.m.
C ++ - Test 004. Pointers, Arrays and Loops
- Result:50points,
- Rating points-4
- molni99
- Oct. 26, 2024, 1:37 a.m.
C ++ - Test 004. Pointers, Arrays and Loops
- Result:80points,
- Rating points4
- molni99
- Oct. 26, 2024, 1:29 a.m.
C ++ - Test 004. Pointers, Arrays and Loops
- Result:20points,
- Rating points-10
Я не питунист, но как-то так: