Skip to content

Commit 96add6a

Browse files
committedJan 28, 2022
fix solution
1 parent 237e24d commit 96add6a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎Python/Module2_EssentialsOfPython/Problems/EncodeAsString.md

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ is equivalent to the long-form code:
9696
out = ""
9797
for x in some_iterable_of_strings:
9898
out += "<hi>" + x
99+
100+
out = out.lstrip("<hi>") # get rid of the extra leading "<hi>"
99101
```
100102

101103
`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:

0 commit comments

Comments
 (0)
Failed to load comments.