Mastering Mini Projects for B.Tech CSE Students - Source Code Included
Engaging in mini projects is an excellent way for B.Tech CSE students to gain practical experience and enhance their coding skills. These projects can range from simple algorithms to more complex software solutions, providing students with a hands-on understanding of various technologies. In this article, we will explore a mini project idea and provide its source code, guiding you through the process. Let's dive right in!
One compelling mini project idea for B.Tech CSE students is implementing a To-Do List Application. This project helps students understand data structures, file handling, and user interface design. Moreover, it's a useful tool that students can use in their daily lives.
To-Do List Application
The To-Do List Application will allow users to add, remove, and view their tasks. We'll use Python for this mini project due to its simplicity and extensive libraries.
Before we begin, ensure you have Python and a text editor or IDE like Visual Studio Code or PyCharm installed on your system.
Creating the Task List
To store tasks, we'll use a simple list data structure. Each task will be represented as a dictionary containing the task name and status (complete or pending).
Here's a simple function to represent the task list and its initialisation:
```python def task_list(): tasks = [] load_tasks(tasks) return tasks ```Loading and Saving Tasks
With Python's built-in `json` module, we can easily load and save task data from/to a file named `tasks.json`.
Below is the code to save tasks to a file.
Adding, Removing, and Viewing Tasks
Now, let's create functions to add, remove, and view tasks. The `add_task` function appends a new task, `remove_task` deletes a task, and `view_tasks` displays all tasks along with their status.
We'll use a simple command-line interface for user interaction. Here are the functions:
add_task
remove_task
```python def remove_task(tasks, task_name): for task in tasks: if task['name'] == task_name: tasks.remove(task) save_tasks(tasks) print(f'Task "{task_name}" removed.') return print('Task not found.') ```view_tasks
```python def view_tasks(tasks): for task in tasks: print(f"{task['name']} - {task['status']}") ```main Function
The `main` function ties everything together by presenting a simple menu to the user and calling the appropriate functions based on their input.
main
```python def main(): tasks = task_list() while True: print("\nTo-Do List\n1. Add task\n2. Remove task\n3. View tasks\n4. Quit") choice = int(input("Enter your choice: ")) if choice == 1: task_name = input("Enter task name: ") add_task(tasks, task_name) elif choice == 2: task_name = input("Enter task name to remove: ") remove_task(tasks, task_name) elif choice == 3: view_tasks(tasks) elif choice == 4: break else: print("Invalid choice. Try again.") if __name__ == "__main__": main() ```With this, you've created a simple yet functional To-Do List Application! You can expand this project by adding features like marking tasks as complete, setting deadlines, or integrating it with a GUI for a better user experience.
Don't forget to share your project with your peers and instructors, and encourage them to contribute to its development. Happy coding!