Untitled

mail@pastecode.io avatar
unknown
python
24 days ago
392 B
1
Indexable
Never
if __name__ == '__main__':
    numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

    print(numbers)

    right_index = len(numbers) - 1
    left_index = 0

    while right_index > left_index:
        temp = numbers[left_index]
        numbers[left_index] = numbers[right_index]
        numbers[right_index] = temp
        left_index += 1
        right_index -= 1

    print(numbers)
Leave a Comment