Untitled

 avatar
unknown
python
9 months ago
392 B
3
Indexable
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)
Editor is loading...
Leave a Comment