So I am coding a checklist in Python 3.5.2. Part of my checklist is the function that is removing something in the list by typing the name of the thing in the list. I have been trying to figure out a way to do it but have not found one. Here is the code that I am working with:
import time
import random
#Intro tells player how to use program
def displayIntro():
print("Hello there, welcome to your Python Checklist.")
time.sleep(2)
print("Please type the name of the chore e.g. rubbish.")
time.sleep(2)
print("To remove a completed chore, type ‘done’ then the name of the chore e.g. done rubbish.")
time.sleep(3)
print("It will tick the box next to the chore you said. ☑")
time.sleep(2)
print("To show unfinished chores type ‘display’ with check boxes next to them. ☐")
#Stores user input in a list
def nameChores():
chores = ''
chores2 = ()
chores3 = ''
chores2 = input('Type chore name: ').split()
print("Chore(s) is now stored.")
while chores != 'display' and chores in chores2:
time.sleep(0.5)
print('Make sure to look at the intro for the commands.')
chores = input().lower()
#Displays the unfinished chores that the player has typed in and appear with unfilled checkboxes next to them
if chores == 'display':
print(chores2)
return chores
#Program looks for chore name and removes it from the list. Says to player it is removed with a tick next to it.
if chores in chores2:
chores2.remove(chores)
print("Chore is now remove. ☑")
nameChores()