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) diff --git a/README.md b/README.md index aff30cd0..a8638218 100644 --- a/README.md +++ b/README.md @@ -583,4 +583,8 @@ Purbendu Halder (Kolkata) Mohd Maaz (Gorakhpur) + +Apoorva Sunkad(Dharwad, Karnataka) + Animesh Jain (Mandsaur) +