Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SonawaneAshwini authored Jul 25, 2024
1 parent 3054ce8 commit f0371cd
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
72 changes: 72 additions & 0 deletions TO-DO List Application/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# TO DO List Application
This Python TODO List Application allows users to manage tasks by adding, viewing, and deleting them through a simple command-line interface.

## Description
The application provides basic functionality to manipulate tasks:

- Add Task: Allows users to input a task which gets added to the task list.
- View Tasks: Displays all tasks currently stored in the list.
- Delete Task: Removes a task based on its index in the list.
- Exit: Terminates the application.

## Installation
1. Clone the Repository:
```bash
git clone https://github.com/yourusername/todo-list.git
cd todo-list
```
2. No Additional Modules Required:
This application only uses Python's standard library, so no additional modules need to be installed.

## How to Run the Script
After cloning the repository and navigating to the project directory:
```bash
python todo_list.py
```
Follow the on-screen prompts to interact with the TODO List Application.

## Script Overview
The 'todo_list.py' script implements a menu-driven interface where users can perform various operations on tasks:

- Add Task: Input a task to add it to the list.
- View Tasks: Display all tasks currently stored.
- Delete Task: Remove a task by specifying its index.
- Exit: Quit the application

## Example Usage
```bash

$ python todo_list.py

TODO List Application
1. Add Task
2. View Tasks
3. Delete Task
4. Exit

Enter your choice: 1
Enter task: Complete assignment
Task 'Complete assignment' added.

2. View Tasks
3. Delete Task
4. Exit

Enter your choice: 2
Tasks:
1. Complete assignment

3. Delete Task
4. Exit

Enter your choice: 3
Enter index of task to delete: 1
Deleted task: 'Complete assignment'

2. View Tasks
3. Delete Task
4. Exit

Enter your choice: 4
Exiting program.
```
46 changes: 46 additions & 0 deletions TO-DO List Application/todo_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
tasks = []

def add_task(task):
tasks.append(task)
print(f"Task '{task}' added.")

def view_tasks():
if not tasks:
print("No tasks.")
else:
print("Tasks:")
for index, task in enumerate(tasks, start=1):
print(f"{index}. {task}")

def delete_task(index):
if 1 <= index <= len(tasks):
deleted_task = tasks.pop(index - 1)
print(f"Deleted task: '{deleted_task}'")
else:
print("Invalid index.")

def todo_list():
while True:
print("\nTODO List Application")
print("1. Add Task")
print("2. View Tasks")
print("3. Delete Task")
print("4. Exit")

choice = input("Enter your choice: ")

if choice == '1':
task = input("Enter task: ")
add_task(task)
elif choice == '2':
view_tasks()
elif choice == '3':
index = int(input("Enter index of task to delete: "))
delete_task(index)
elif choice == '4':
print("Exiting program.")
break
else:
print("Invalid input. Please try again.")

todo_list()

0 comments on commit f0371cd

Please sign in to comment.