diff --git a/Task_Appication b/Task_Appication new file mode 100644 index 0000000..a636359 --- /dev/null +++ b/Task_Appication @@ -0,0 +1,126 @@ +# Görev durumları için sabitler (Constants), Sabitler genelde buyuk harfle tanimlanir ornek : PI = 3,14 gibi. +TAMAMLANDI = "Tamamlandı" +BEKLEMEDE = "Beklemede" +SILINDI = "Silindi" + +# Görev listesi ve boş slotlar +tasks = [] +empty_slots = [] + +# Görev ekleme fonksiyonu +def add_task(task_name): + task_id = len(tasks) + 1 if not empty_slots else empty_slots.pop(0) + tasks.append({"id": task_id, "task": task_name, "status": BEKLEMEDE}) + print(f"{task_name} adlı görev eklendi. Görev ID: {task_id}") + +# Görev tamamlama fonksiyonu +def complete_task(): + if not tasks: + print("Hiç görev yok.") + return + + print("\nTamamlanabilecek görevler:") + for task in tasks: + if task["status"] == BEKLEMEDE: + print(f"{task['id']}. {task['task']}") + + try: + task_id = int(input("Tamamlamak istediğiniz görevin numarasını girin: ")) + for task in tasks: + if task["id"] == task_id and task["status"] == BEKLEMEDE: + task["status"] = TAMAMLANDI + print(f"{task_id} numaralı görev tamamlandı.") + return + print("Geçersiz görev numarası.") + except ValueError: + print("Geçersiz giriş. Lütfen bir numara girin.") + +# Görev silme fonksiyonu +def delete_task(): + if not tasks: + print("Hiç görev yok.") + return + + print("\nSilinebilecek görevler:") + for task in tasks: + if task["status"] != SILINDI: + print(f"{task['id']}. {task['task']} - Durum: {task['status']}") + + try: + task_id = int(input("Silmek istediğiniz görevin numarasını girin: ")) + for task in tasks: + if task["id"] == task_id and task["status"] != SILINDI: + task["status"] = SILINDI + empty_slots.append(task_id) # Silinen görevin id'sini boş slotlara ekle + print(f"{task_id} numaralı görev silindi.") + return + print("Geçersiz görev numarası.") + except ValueError: + print("Geçersiz giriş. Lütfen bir numara girin.") + +# Tamamlanmış görevleri listeleme fonksiyonu +def list_completed_tasks(): + print("Tamamlanmış görevler:") + completed_tasks = [task for task in tasks if task["status"] == TAMAMLANDI] + if not completed_tasks: + print("Henüz tamamlanmış görev yok.") + else: + for i, task in enumerate(completed_tasks): + print(f"{i + 1}. {task['task']}") + +# Tüm görevleri listeleme fonksiyonu +def list_all_tasks(): + print("Tüm görevler:") + if not tasks: + print("Hiç görev yok.") + return + for task in tasks: + print(f"{task['id']}. {task['task']} - Durum: {task['status']}") + +# Görev arama fonksiyonu +def search_task(): + search_term = input("Aramak istediğiniz görev adını girin: ") + found_tasks = [task for task in tasks if search_term.lower() in task["task"].lower()] + + if found_tasks: + print("Bulunan görevler:") + for task in found_tasks: + print(f"{task['id']}. {task['task']} - Durum: {task['status']}") + else: + print("Hiçbir görev bulunamadı.") + +# Ana Menü +def main_menu(): + while True: + print("\n1. Yeni görev ekle") + print("2. Görev tamamla") + print("3. Görev sil") + print("4. Tamamlanmış görevleri listele") + print("5. Tüm görevleri listele") + print("6. Görev ara") + print("7. Çıkış") + + choice = input("Bir seçenek girin: ") + + if choice == '1': + task_name = input("Görev adını girin: ") + add_task(task_name) + elif choice == '2': + complete_task() + elif choice == '3': + delete_task() + elif choice == '4': + list_completed_tasks() + elif choice == '5': + list_all_tasks() + elif choice == '6': + search_task() + elif choice == '7': + print("Çıkılıyor...") + break + else: + print("Geçersiz seçim. Lütfen tekrar deneyin.") + +# Programı çalıştır +if __name__ == "__main__": + main_menu() diff --git a/code_test.ipynb b/code_test.ipynb new file mode 100644 index 0000000..13c0a4f --- /dev/null +++ b/code_test.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1. Görev 1\n", + "2. Görev 2\n", + "3. Görev 3\n" + ] + } + ], + "source": [ + "tasks = [\"Görev 1\", \"Görev 2\", \"Görev 3\"]\n", + "\n", + "for i, task in enumerate(tasks):\n", + " print(f\"{i + 1}. {task}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}