Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created April 7, 2020 15:01
Show Gist options
  • Select an option

  • Save azamsharp/f03b7c60edd98017bd2db8fed5ebfd90 to your computer and use it in GitHub Desktop.

Select an option

Save azamsharp/f03b7c60edd98017bd2db8fed5ebfd90 to your computer and use it in GitHub Desktop.
# Ask the user for input for name
# Ask the user for priority
# create a task using name and priority
# add the task to list of tasks
# list to hold al the tasks
all_tasks = []
class Task:
def __init__(self, name, priority):
self.name = name
self.priority = priority
self.completed = False
self.username = ""
while True:
print("Enter 1 to add new task")
print("Enter 2 to add delete task")
print("Enter 3 to add view all tasks")
print("Enter q to quit")
choice = input("Enter choice: ")
if choice == "1":
name = input("Enter task name: ")
priority = input("Enter priority: ")
# create a task object
task = Task(name, priority)
# add task to an array
all_tasks.append(task)
elif choice == "3":
# display the tasks
for index in range(0, len(all_tasks)):
a_task = all_tasks[index]
print(a_task.name + '-' + a_task.priority)
elif choice == "q":
break
#choice = input("Enter q to quit or any key to continue: ")
#if choice == "q":
# break the while loop
# break
print("After the loop")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment