Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays i #3020

Merged
merged 6 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Types of change:
### Changed
- [Html - Link Relative Paths - Change part of PQ as it wasn't worder properly](https://github.com/enkidevs/curriculum/pull/2985)
- [Python - Format Text Paragraphs With Textwrap - Make the fill method more clear](https://github.com/enkidevs/curriculum/pull/2981)
- [Python - Arrays I - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3020)

## January 4th 2022

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ The `reversed` built-in allows us to create an iterator for an iterable sequence
reversed(seq)
```

Where `seq` is an iterable sequence such as a tuple, list, string or range. This returns an iterator which accesses the elements in the sequence in the reverse order. For example, we may use `reversed` to reverse the order of characters in a string.
Where `seq` is an iterable sequence such as a tuple, list, string, or range. This returns an iterator, which accesses the elements in the sequence in the reverse order. For example, we may use `reversed` to reverse the order of characters in a string.

```python
ourString = 'enki'
print(list(reversed(ourString)))
# Result: ['i', 'k', 'n', 'e']
```

Notice how we could create custom classes that implement the `__reversed__()` method and then use `reversed` on them to quickly and efficiently reverse their ordering. In this way we can begin to see how often the `reversed` function might be useful in day-to-day programming tasks.
Notice how we could create custom classes that implement the `__reversed__()` method and then use `reversed` on them to quickly and efficiently reverse their ordering. In this way, we can begin to see how often the `reversed` function might be useful in day-to-day programming tasks.


---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ print(ourString[sObject])
Use `slice` to remove every second number in the list of numbers.

```python
nList = ['1', '2', '3', '4', '5',
'6', '7', '8']
nList = ['1', '2', '3', '4', '5', '6', '7', '8']

sObject = ???(???, ???, ???)
print(nList[sObject])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,9 @@ We have three lists, `fnames`, `lnames`, `locations`, which are ordered so that
Fill in the gaps in the code below to achieve this.

```python
locations = ['IT',
'FR',
'FR',
'RU']
fnames = ['italo',
'jean',
'emily',
'katya']
lnames = ['calvino',
'micheal',
'rambert',
'sokolov']
locations = ['IT', 'FR', 'FR', 'RU']
fnames = ['italo', 'jean', 'emily', 'katya']
lnames = ['calvino', 'micheal', 'rambert', 'sokolov']

result = zip(???, ???)
result2 = zip(???, ???)
Expand Down