For Ch 1 problem 3, couldn't a much simpler solution work?
Tylersuard opened this issue · 0 comments
Tylersuard commented
Here is what I got:
def URLify(string, true_len):
newstring = ""
for i in range(true_len):
if string[i] != " ":
newstring = newstring + string[i]
else:
newstring = newstring + "%20"
print(newstring)
URLify("Mr John Smith ",13)
The algorithm in the book us much more complicated than this. Why would this not work instead?