num = [7, -5, 11, 3, 5, 12, 6, 8]
n = len(num)
num[0], num[n-2] = num[n-2], num[0]
num[1], num[n-1] = num[n-1], num[1]
print("Результат:", num)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
num = [7, -5, 11, 3, 5, 12, 6, 8]
n = len(num)
num[0], num[n-2] = num[n-2], num[0]
num[1], num[n-1] = num[n-1], num[1]
print("Результат:", num)