Skip to content

Commit

Permalink
fix solution
Browse files Browse the repository at this point in the history
  • Loading branch information
rsokl committed Jan 28, 2022
1 parent 237e24d commit 96add6a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Python/Module2_EssentialsOfPython/Problems/EncodeAsString.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ is equivalent to the long-form code:
out = ""
for x in some_iterable_of_strings:
out += "<hi>" + x

out = out.lstrip("<hi>") # get rid of the extra leading "<hi>"
```

`int_to_str` plays a clever trick to convert each integer, digit-by-digit, into its string form - it calls `str` on the integer. This converts the integer into a string, which is a [sequence](https://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/SequenceTypes.html). This permits us to access each digit of the integer and even iterate over them:
Expand Down

0 comments on commit 96add6a

Please sign in to comment.