Closed mgsosna closed 6 years ago
Thanks for writing this book - very helpful. One issue with chapter 6 challenge 4, though:
The book requests ["Where now?", "Who now?", "When now?"].
["Where now?", "Who now?", "When now?"]
The solution provided produces ["Where now", "Who now", "When now", ""] instead.
["Where now", "Who now", "When now", ""]
This code should work:
our_string = "Where now? Who now? When now?" new_list = our_string.split("?") del new_list[-1]
our_string = "Where now? Who now? When now?"
new_list = our_string.split("?")
del new_list[-1]
new_list2 = [item.strip() + "?" for item in new_list] print(new_list2)
new_list2 = [item.strip() + "?" for item in new_list]
print(new_list2)
Thanks for writing this book - very helpful. One issue with chapter 6 challenge 4, though:
The book requests
["Where now?", "Who now?", "When now?"]
.The solution provided produces
["Where now", "Who now", "When now", ""]
instead.