Skip to content

Commit ff83419

Browse files
authored
fix(curriculum): update examples in lecture-working-with-loops-and-sequences (freeCodeCamp#64379)
1 parent 2fee689 commit ff83419

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

curriculum/challenges/english/blocks/lecture-working-with-loops-and-sequences/6839e38cdf93ee5a00c79676.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ print(numbers) # [1, 2, 2.5, 3, 4, 5]
5656

5757
The following code will insert the number `2.5` at index `2` in the `numbers` list.
5858

59-
If you want to remove an element from a list, you can use the `remove()` method. Here is an example of using the `remove()` method to remove a duplicate number from a `numbers` list:
59+
If you want to remove an element from a list, you can use the `remove()` method. The `remove()` method takes the value of the element to remove as an argument:
6060

6161
```py
62-
numbers = [1, 2, 3, 4, 5, 5]
63-
numbers.remove(5)
62+
numbers = [10, 20, 30, 40, 50, 50]
63+
numbers.remove(50)
6464

65-
print(numbers) # [1, 2, 3, 4, 5]
65+
print(numbers) # [10, 20, 30, 40, 50]
6666
```
6767

6868
It is important to note that this method will only remove the first occurrence of an item. Not all of them:
6969

7070
```py
71-
numbers = [1, 2, 3, 4, 5, 5, 5]
72-
numbers.remove(5)
71+
numbers = [10, 20, 30, 40, 50, 50, 50]
72+
numbers.remove(50)
7373

74-
print(numbers) # [1, 2, 3, 4, 5, 5]
74+
print(numbers) # [10, 20, 30, 40, 50, 50]
7575
```
7676

7777
To remove an element at a specific index in the list, you can use the `pop()` method like this:

0 commit comments

Comments
 (0)