Edit list and Strikethrough text

2 weeks ago 8
ARTICLE AD BOX

So for this ChatBot I'm making to get more used to Python, here's what I wanna do. I want to make it so that for a To-Do list, once you print it out and the bot asks "Anything else you'd like me to help out with?", you can say that you're done with a task on the list, and it'll strike it out (For example if one of the items on the list is doing laundry, if you input "Done with Laundry" or anything of that nature, it'll reprint the list with "~~1. Laundry~~"). Maybe even say "Nice job!" or "Keep it up!" afterwards. How would I go about doing that?

My code so far:

Toodle-Doo Main.py from ChoresList import handle_ChoresList # ------------------------------------------------- quitKeyWords = ['quit', 'exit', 'done', 'finished', 'all good'] listKeyWords = ['to-do', 'to do', 'list', 'chores'] # ------------------------------------------------- def main(): print("Hello, I'm Toodle-Doo! A chatbot tool made to help you stay productive.") print("\nWhat would you like to do today?\n") while True: userInput = input().strip() # Exit if any(word in userInput.lower() for word in quitKeyWords): print("\nGood work today! Take care :)") break # To-Do List: elif any(word in userInput.lower() for word in listKeyWords): handle_ChoresList() print("\nAnything else you'd like me to help out with?\n" else: print("\nI'm not sure what to say to that. Please enter something else.\n") if __name__ == "__main__": main() ChoresList.py # To-Do List def handle_ChoresList(): print("\nOkay! Please type in your list of activities you want to get done today." " When you're finished, type 'complete'!") activities = [] count = 1 while True: item = input(f"{count}. ").strip() if item.lower() == "complete": break if item == "": print("\nPlease enter an activity, or type 'complete' if you are done.") continue activities.append(item) count += 1 print("\nYour Activities:") for i, task in enumerate(activities, 1): print(f"{i}. {task}")
Read Entire Article