Skip to content
Merged
Changes from all 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
29 changes: 29 additions & 0 deletions episodes/01-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,35 @@ else:

:::::::::::::::::::::::::::::::::::::::::::::::

## Functions

::::::::::::::::::::::::::::::::::::: challenge

### 8\. Creating a function

Using string slicing, write a function called `outer` that returns a string made up of the first and last characters of an input variable, so that a call to your function should give the following result:

```python
print(outer('aluminium'))
print(outer("gold"))
```
```output
am
gd
```

::::::::::::::: solution

```python
def outer(input_string):
return input_string[0] + input_string[-1]
```

:::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::::::: callout

## Formatting Variables and Objects in Strings
Expand Down
Loading