From d4f7e584b78bf14dbfb7ee5402be8f5b5b1c10f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Sat, 20 May 2023 12:22:48 +0300 Subject: [PATCH] reverse list --- list.while.2.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 list.while.2.py diff --git a/list.while.2.py b/list.while.2.py new file mode 100644 index 0000000..b79f242 --- /dev/null +++ b/list.while.2.py @@ -0,0 +1,7 @@ +a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +i = 0 +lena = len(a) +while i < lena // 2: + a[i], a[lena - 1 - i] = a[lena - 1 - i], a[i] + i += 1 +print(a) \ No newline at end of file