From 7d462571086fcfc07a7ce45452097e472abb120d Mon Sep 17 00:00:00 2001 From: Apoorva Date: Thu, 27 Oct 2022 23:30:54 +0530 Subject: [PATCH 1/2] I have added How to reverse a list in python --- Python for Beginners/first.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Python for Beginners/first.py b/Python for Beginners/first.py index 40e463a0..2a323da0 100644 --- a/Python for Beginners/first.py +++ b/Python for Beginners/first.py @@ -266,4 +266,19 @@ print(Max) - +#Reversing a list in Python by two methods +# Method 1 - By using reverse() built-in function +# Input: list = [4,7,9,3,1] +# Output: [1,3,9,7,4] + +lst = [4,7,9,3,1] +lst.reverse() +print("Using reverse() ", lst) + +#Method 2 - By Insertion method +lst = [4,7,9,3,1] +l = [] +for i in lst: + #reversig the list + l.insert(0,i) +print(l) From 47dcdd4cbea1949497f7a56b4273bc23ce90e56e Mon Sep 17 00:00:00 2001 From: Apoorva Date: Thu, 27 Oct 2022 23:43:28 +0530 Subject: [PATCH 2/2] Updated this Readme file for hacktoberfest challenge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 520a98dd..1e60e649 100644 --- a/README.md +++ b/README.md @@ -582,3 +582,5 @@ Jayesh Rajput (Pune) Purbendu Halder (Kolkata) Mohd Maaz (Gorakhpur) + +Apoorva Sunkad(Dharwad, Karnataka)