mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): update count() function to count() method in tuple section (#66162)
This commit is contained in:
+2
-2
@@ -355,14 +355,14 @@ programming_languages = ('Rust', 'Java', 'Python', 'C++', 'Rust')
|
||||
programming_languages.count('Rust') # 2
|
||||
```
|
||||
|
||||
- If the specified item in the `count()` function is not present at all in the tuple, then the return value will be `0`:
|
||||
- If the specified item in the `count()` method is not present at all in the tuple, then the return value will be `0`:
|
||||
|
||||
```py
|
||||
programming_languages = ('Rust', 'Java', 'Python', 'C++', 'Rust')
|
||||
programming_languages.count('JavaScript') # 0
|
||||
```
|
||||
|
||||
- If no arguments are passed to the `count()` function, then Python will return a `TypeError`.
|
||||
- If no arguments are passed to the `count()` method, then Python will return a `TypeError`.
|
||||
|
||||
- **index()**: Used to find the index where a particular item is present in the tuple. Here is an example of using the `index()` method to find the index for the language `'Java'`:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user