Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ Personal solutions to [**Python** track][python_track] exercises from [**Exercis
5. ["**Meltdown Mitigation**" solution](python/meltdown-mitigation/conditionals.py).
6. ["**Black Jack**" solution](python/black-jack/black_jack.py).
7. ["**Little Sister's Essay**" solution](python/little-sisters-essay/string_methods.py).
8. ["**Little Sister's Vocabulary**" solution](python/little-sisters-vocab/strings.py).
<!-- Put next solution item here! -->

[python_version_badge]: https://img.shields.io/badge/Python%203.13-3776AB?logo=python&logoColor=FFD43B
[track_completion_badge]: https://img.shields.io/badge/Track%20completion-4.8%25-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[exercises_completed_badge]: https://img.shields.io/badge/Exercises%20completed-7%2F146-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[track_completion_badge]: https://img.shields.io/badge/Track%20completion-5.5%25-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[exercises_completed_badge]: https://img.shields.io/badge/Exercises%20completed-8%2F146-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[python_track]: https://exercism.org/tracks/python
[exercism]: https://exercism.org
39 changes: 39 additions & 0 deletions python/little-sisters-vocab/HINTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Hints

## General

- The Python Docs [Tutorial for strings][python-str-doc] has an overview of the Python `str` type.
- String methods [`str.join()`][str-join] and [`str.split()`][str-split] ar very helpful when processing strings.
- The Python Docs on [Sequence Types][common sequence operations] has a rundown of operations common to all sequences, including `strings`, `lists`, `tuples`, and `ranges`.

There's four activities in the assignment, each with a set of text or words to work with.

## 1. Add a prefix to a word

- Small strings can be concatenated with the `+` operator.

## 2. Add prefixes to word groups

- Believe it or not, [`str.join()`][str-join] is all you need here. **A loop is not required**.
- The tests will be feeding your function a `list`. There will be no need to alter this `list` if you can figure out a good delimiter string.
- Remember that delimiter strings go between elements and "glue" them together into a single string. Delimiters are inserted _without_ space, although you can include space characters within them.
- Like [`str.split()`][str-split], `str.join()` can process an arbitrary-length string, made up of any unicode code points. _Unlike_ `str.split()`, it can also process arbitrary-length iterables like `list`, `tuple`, and `set`.

## 3. Remove a suffix from a word

- Strings can be indexed or sliced from either the left (starting at 0) or the right (starting at -1).
- If you want the last code point of an arbitrary-length string, you can use `[-1]`.
- The last three letters in a string can be "sliced off" using a negative index. e.g. `beautiful'[:-3] == 'beauti`

## 4. Extract and transform a word

- Using [`str.split()`][str-split] returns a `list` of strings broken on white space.
- `lists` are sequences, and can be indexed.
- [`str.split()`][str-split] can be directly indexed: `'Exercism rocks!'.split()[0] == 'Exercism'`
- Be careful of punctuation! Periods can be removed via slice: `'dark.'[:-1] == 'dark'`


[common sequence operations]: https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
[python-str-doc]: https://docs.python.org/3/tutorial/introduction.html#strings
[str-join]: https://docs.python.org/3/library/stdtypes.html#str.join
[str-split]: https://docs.python.org/3/library/stdtypes.html#str.split
Loading
Loading