Fix typos
This commit is contained in:
@ -5,7 +5,7 @@ tags: list,beginner
|
|||||||
|
|
||||||
Checks if all the values in a list are unique.
|
Checks if all the values in a list are unique.
|
||||||
|
|
||||||
- Use `set()` on the given list to keep only unique occurences.
|
- Use `set()` on the given list to keep only unique occurrences.
|
||||||
- Use `len()` to compare the length of the unique values to the original list.
|
- Use `len()` to compare the length of the unique values to the original list.
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|||||||
@ -5,7 +5,7 @@ tags: date,intermediate
|
|||||||
|
|
||||||
Creates a list of dates between `start` (inclusive) and `end` (not inclusive).
|
Creates a list of dates between `start` (inclusive) and `end` (not inclusive).
|
||||||
|
|
||||||
- Use `datetime.timedelta.days` to get the days betwen `start` and `end`.
|
- Use `datetime.timedelta.days` to get the days between `start` and `end`.
|
||||||
- Use `int()` to convert the result to an integer and `range()` to iterate over each day.
|
- Use `int()` to convert the result to an integer and `range()` to iterate over each day.
|
||||||
- Use a list comprehension and `datetime.timedelta()` to create a list of `datetime.date` objects.
|
- Use a list comprehension and `datetime.timedelta()` to create a list of `datetime.date` objects.
|
||||||
|
|
||||||
@ -19,6 +19,6 @@ def daterange(start, end):
|
|||||||
```py
|
```py
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
daterange(date(2020, 10, 1), date(2020, 10, 5))
|
daterange(date(2020, 10, 1), date(2020, 10, 5))
|
||||||
# [date(2020, 10, 1), date(2020, 10, 2), date(2020, 10, 3), date(2020, 10, 4)]
|
# [date(2020, 10, 1), date(2020, 10, 2), date(2020, 10, 3), date(2020, 10, 4)]
|
||||||
```
|
```
|
||||||
|
|||||||
@ -3,7 +3,7 @@ title: from_iso_date
|
|||||||
tags: date,intermediate
|
tags: date,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Converts a date from its ISO-8601 represenation.
|
Converts a date from its ISO-8601 representation.
|
||||||
|
|
||||||
- Use `datetime.datetime.fromisoformat()` to convert the given ISO-8601 date to a `datetime.datetime` object.
|
- Use `datetime.datetime.fromisoformat()` to convert the given ISO-8601 date to a `datetime.datetime` object.
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ tags: list,intermediate
|
|||||||
|
|
||||||
Checks if the elements of the first list are contained in the second one regardless of order.
|
Checks if the elements of the first list are contained in the second one regardless of order.
|
||||||
|
|
||||||
- Use `count()` to check if any value in `a` has more occurences than it has in `b`.
|
- Use `count()` to check if any value in `a` has more occurrences than it has in `b`.
|
||||||
- Return `False` if any such value is found, `True` otherwise.
|
- Return `False` if any such value is found, `True` otherwise.
|
||||||
|
|
||||||
```py
|
```py
|
||||||
|
|||||||
@ -3,7 +3,7 @@ title: to_iso_date
|
|||||||
tags: date,intermediate
|
tags: date,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Converts a date to its ISO-8601 represenation.
|
Converts a date to its ISO-8601 representation.
|
||||||
|
|
||||||
- Use `datetime.datetime.isoformat()` to convert the given `datetime.datetime` object to an ISO-8601 date.
|
- Use `datetime.datetime.isoformat()` to convert the given `datetime.datetime` object to an ISO-8601 date.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user