Team2_HW_Week3#20
Open
alahdalmokhtar wants to merge 10 commits intowerhereitacademy:mainfrom
Open
Conversation
HW_Teamleider_Week3
next_number = 1
def add_task():
global next_number
name = input("Enter the task name: ")
# Check for any task marked as 'removed' to reuse the slot
for t in tasks:
if t['status'] == 'Removed':
t['name'] = name
t['status'] = 'Not Done'
print("Task added at slot", t['number'])
return
# Add a new task if no 'removed' tasks
tasks.append({'number': next_number, 'name': name, 'status': 'Not Done'})
print("Task added with number", next_number)
next_number += 1
def finish_task():
num = int(input("Enter task number to mark as finished: "))
for t in tasks:
if t['number'] == num and t['status'] == 'Not Done':
t['status'] = 'Completed'
print("Task", num, "is now completed.")
return
print("Task not found or already completed.")
def remove_task():
num = int(input("Enter task number to remove: "))
for t in tasks:
if t['number'] == num and t['status'] != 'Removed':
t['status'] = 'Removed'
print("Task", num, "has been removed.")
return
print("Task not found or already removed.")
def show_completed_tasks():
print("\nCompleted Tasks:")
for t in tasks:
if t['status'] == 'Completed':
print(t['number'], t['name'])
def show_all_tasks():
print("\nAll Tasks:")
for t in tasks:
print(t['number'], t['name'], "-", t['status'])
while True:
print("\nChoose an option:")
print("1- Add Task")
print("2- Finish Task")
print("3- Remove Task")
print("4- Show Completed Tasks")
print("5- Show All Tasks")
print("6- Exit")
choice = input("Enter your choice: ")
if choice == '1':
add_task()
elif choice == '2':
finish_task()
elif choice == '3':
remove_task()
elif choice == '4':
show_completed_tasks()
elif choice == '5':
show_all_tasks()
elif choice == '6':
print("Goodbye!")
break
else:
print("Invalid choice. Please try again.")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Solutions for team 2 Done !