From 9b76a135e4d716e11d7fb639a33d97f008ef341b Mon Sep 17 00:00:00 2001 From: raviram Date: Thu, 29 Nov 2018 06:21:55 +0530 Subject: [PATCH] Added example code with duplicates in list (#23629) * Added example code with duplicates in list * Reworded sentence to introduce duplicates --- .../english/python/lists/list-remove-method/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/guide/english/python/lists/list-remove-method/index.md b/guide/english/python/lists/list-remove-method/index.md index 09a1157f83..2386edfd1e 100644 --- a/guide/english/python/lists/list-remove-method/index.md +++ b/guide/english/python/lists/list-remove-method/index.md @@ -32,6 +32,18 @@ Traceback (most recent call last): File "", line 1, in ValueError: list.remove(x): x not in list ``` +If there are duplicate elements in the list, the `remove()` function removes the first occurrence of the element. +```py +numbers=[1,2,3,4,5,1,6] +numbers.remove(1) +print(numbers) +``` +#### Output +```py +[2,3,4,5,1,6] +``` + + #### More Information: More information about `remove()` can be found here