From 704ebe4bd536056cf65c3f93670749ad2bc4cb01 Mon Sep 17 00:00:00 2001 From: feyzkoylu <127228399+feyzkoylu@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:55:59 +0200 Subject: [PATCH 1/3] fk_week2 --- .DS_Store | Bin 0 -> 6148 bytes week2.ipynb | 449 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 449 insertions(+) create mode 100644 .DS_Store create mode 100644 week2.ipynb diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a8408b84c527b29d0196a6dd3578fe12ade2913e GIT binary patch literal 6148 zcmeHKyG{c^3>-s>Aexkv`vnL-0BMOX1qBWK017FCQl-C&@8Zvr@k5B{ph2QRW67Rf zuje*5#W@CG%l+mSSOA#Q9r5mAYJToMv9rn;k_O z9M%&RrGOMTRp30g3-A9c`VaH}DM>piAO-%F0yZ0-hb3RBdh6unyw^7R3*Boz=x$sG og(2E8G1@UV-j1)LDC?T9dEN`h#Go@DbfW$YxGpj&@Yf0)0c_G5CjbBd literal 0 HcmV?d00001 diff --git a/week2.ipynb b/week2.ipynb new file mode 100644 index 0000000..ca64aee --- /dev/null +++ b/week2.ipynb @@ -0,0 +1,449 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b8539b26", + "metadata": {}, + "source": [ + "# **Python_Modul_Week_2**\n", + "## **Question1: Student Grades Processing**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5692826a", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "# You need to write a Python program to process a student's grades. The program needs to perform the following functions:\n", + "# Store information and notes for 10 students using a dictionary. \n", + "# Let each student have their name, surname and grades (Midterm, Final and Oral grades). For example:\n", + "\n", + "students = {\n", + " \"ahmet yilmaz\" : [85,90,78], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Mehmet Demir\" : [92,88,76], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Ayse Kaya\" : [78,89,95], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Zeynep Celik\" : [65,70,80], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Ali Kara\" : [50,60,55], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Fatma Yildiz\" : [88,85,90], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Murat Aydin\" : [72,68,74], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Elif Aksoy\" : [95,90,88], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Hakan Ozyurek\": [45,50,55], # Midterm: 85, Final: 90, Oral: 78\n", + " \"ahmet yilmaz\" : [80,75,82] # Midterm: 85, Final: 90, Oral: 78\n", + "\n", + "}\n" + ] + }, + { + "cell_type": "markdown", + "id": "4d526007", + "metadata": {}, + "source": [ + "### **•1-Calculate each student's GPA and add it to the dictionary.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b65b79d4", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "gpa_dict = {i: \"{:.2f}\".format(sum(students[i])/3) for i in students.keys()}\n", + "print(gpa_dict)" + ] + }, + { + "cell_type": "markdown", + "id": "6f1628bf", + "metadata": {}, + "source": [ + "### **•2-Find the student with the highest GPA and print it on the screen.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e46695bb", + "metadata": {}, + "outputs": [], + "source": [ + "for key, value in gpa_dict.items():\n", + " if value == max(gpa_dict.values()):\n", + " print(key)" + ] + }, + { + "cell_type": "markdown", + "id": "8cbf2ee0", + "metadata": {}, + "source": [ + "### **•3- Separate each student's name from their surname and store them in a separate tuple and add them to a list.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3920e4da", + "metadata": {}, + "outputs": [], + "source": [ + "studens_information = list()\n", + "for key in students.keys():\n", + " ad, soyad = key.split()\n", + " studens_information.append((ad,soyad))\n", + "\n", + "print(studens_information)" + ] + }, + { + "cell_type": "markdown", + "id": "628d83de", + "metadata": {}, + "source": [ + "### **•4-Sort the names in alphabetical order and print the sorted list on the screen.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "926769f0", + "metadata": {}, + "outputs": [], + "source": [ + "print(sorted(students.keys()))" + ] + }, + { + "cell_type": "markdown", + "id": "e0753377", + "metadata": {}, + "source": [ + "### **•5-Keep students with a GPA below 70 in a cluster (set).•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2f9ddfe", + "metadata": {}, + "outputs": [], + "source": [ + "students_with_70_gpa = set()\n", + "for key, value in gpa_dict.items():\n", + " if float(value) <= 70:\n", + " students_with_70_gpa.add(key)\n", + "print(students_with_70_gpa)" + ] + }, + { + "cell_type": "markdown", + "id": "a2cb3a6b", + "metadata": {}, + "source": [ + "## Question 2: Film Library Management System Project\n", + "### Project Description: This project aims to create an application that will help the user manage their movie collection. Users can add, edit, delete movies and view their collection.\n", + "\n", + "Data Structures Used: Dictionaries (to store movies and related information), lists (to display movie collection)\n", + "\n", + "## Basic Functions:\n", + "\n", + "•1-Create a movie data by taking information such as movie name, director, release year and genre from the user and store it in a dictionary.•**\n", + "\n", + "•2-Give the user the option to edit or delete a movie. (For this, a suitable function must be written for whatever data they want to change about the movie.) \n", + "\n", + "•3-Allow the user to view their collection. List all movies or filter by criteria such as genre or year of release.•\n", + "\n", + "•4-Save the movie data in a file and restore this data when you start the program.•\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ac83a9a", + "metadata": {}, + "outputs": [], + "source": [ + "from IPython.display import clear_output\n", + "movie_information = dict()\n", + "\n", + "\n", + "\n", + "def koleksiyon_goruntuleme():\n", + " clear_output()\n", + " print(\"dosya okuma baslatiliyor ...\\n\")\n", + " print(\"-\"*30)\n", + " dosya_okuma()\n", + " print(\"dosya okuma basarili ...\")\n", + "\n", + "def dosya_yazma():\n", + " with open(\"film_kutuphane.txt\", \"w\") as dosya:\n", + " for i,j in movie_information.items():\n", + " dosya.writelines(\"{}\\t{}\\n\".format(i,j))\n", + " dosya.seek(0) # Okuma yapabilmek için başa sar\n", + " \n", + "def dosya_okuma():\n", + " with open(\"film_kutuphane.txt\", \"r\") as dosya:\n", + " dosya.seek(0)\n", + " print(dosya.read())\n", + "\n", + " # try:\n", + " # dosya = open(\"film_kutuphane.txt\",\"a\")\n", + " # if dosya.tell() != 0:\n", + " # dosya.seek(0)\n", + " # dosya.read()\n", + " # else:\n", + " # dosya.read()\n", + " # except IOError:\n", + " # print(\"dosya okumada bir hata olurstu\")\n", + " # finally:\n", + " # dosya.close()\n", + "\n", + "def film_ekleme():\n", + " clear_output()\n", + " film_adi = input(\"film adi giriniz: \").lower()\n", + " film_yonetmen = input(\"yonetmen adi giriniz: \").lower()\n", + " film_yili = int(input(\"film yilini giriniz: \"))\n", + " film_turu = input(\"film turunu giriniz: \").lower()\n", + " \n", + " movie_information[film_adi] = [film_yonetmen, film_yili, film_turu]\n", + " dosya_yazma()\n", + "\n", + "def film_duzenleme():\n", + " clear_output()\n", + " if \"evet\" == input(\"filmin adini degistirmek isiyormusun?(evet/hayir)?\"):\n", + " degistirilecek_filmin_adi = input(\"hangi filmin adini degistirmek istiyorsun?\").lower()\n", + " yeni_film_adi = input(\"filmin yeni adini giriniz ...\").lower()\n", + "\n", + " if degistirilecek_filmin_adi in movie_information.keys():\n", + " movie_information[yeni_film_adi] = movie_information.pop(degistirilecek_filmin_adi)\n", + " else:\n", + " print(\"Böyle bir film bulunamadı.\")\n", + "\n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + " if \"evet\" == input(\"film detayini degistirmek istiyormusun?(evet/hayir)?\"):\n", + "\n", + " degistirilecek_filmin_adi = input(\"hangi filmin detayini degistirmek istiyorsunuz?\")\n", + " kullanici_secenegi = input(\"hangi detayi degistirmek istiyorsun(yonetmen, film yili, film turu)\").lower()\n", + "\n", + " if kullanici_secenegi == \"yonetmen\":\n", + " movie_information[degistirilecek_filmin_adi][0] = input(\"yeni yonetmen adini giriniz: \")\n", + " elif kullanici_secenegi == \"filmyili\" or \"film yili\":\n", + " movie_information[degistirilecek_filmin_adi][1] = int(input(\"filmin yilini giriniz\"))\n", + " elif kullanici_secenegi == \"filmturu\" or \"film turu\":\n", + " movie_information[degistirilecek_filmin_adi][2] = input(\"filmin turunu giriniz: \")\n", + " \n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + "def film_silme():\n", + " if \"evet\" == input(\"koleksiyonda film silmek istiyormusun(evet/hayir)?\").lower():\n", + " silinecek_film_adi = input(\"hangi filmi silmek istiyorsun?\").lower()\n", + " movie_information.pop(silinecek_film_adi)\n", + " print(\"{:<3} film basarili bir sekilde silindi...\".format(silinecek_film_adi))\n", + "\n", + " print(\"koleksiyonun son hali;\\n\")\n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + " if \"evet\" == input(\"koleksiyondan film detayini silmek istiyormusun(evet/hayir)?\"):\n", + "\n", + " silinece_film = input(\"hangi filmin detayini silmek isiyorsun\")\n", + "\n", + " silinecek_film_detayi = input(\"filmin hangi detayi silmek istiyorsun(yonetmen, film yili, film turu)\").lower()\n", + "\n", + " if silinecek_film_detayi == \"yonetmen\":\n", + " movie_information[silinece_film].pop(0)\n", + " elif silinecek_film_detayi == \"film yili\" or \"film yili\":\n", + " movie_information[silinece_film].pop(1)\n", + " elif silinecek_film_detayi == \"film turu\" or \"filmturu\":\n", + " movie_information[silinece_film].pop(2)\n", + " else:\n", + " print(\"yanlis giris yapildi\")\n", + "\n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "#-------------- algoritma baslangici -----------------------------\n", + "\n", + "while True: \n", + " kullanici_girisi = int(input(\"\"\" yapmak istediginiz islemin numarasini giriniz(1-5): \n", + " 1 - film ekleme\n", + " 2 - film duzenleme\n", + " 3 - film silme \n", + " 4 - koleksiyon goruntuleme \n", + " 5 - cikis yapma \"\"\"))\n", + " if kullanici_girisi == 1: \n", + " film_ekleme() #en son dosyaya kayit islemi yapiliyor\n", + " elif kullanici_girisi == 2: \n", + " film_duzenleme() #en son dosyaya kayit islemi yapiliyor\n", + " elif kullanici_girisi == 3: \n", + " film_silme() #en son dosyaya kayit islemi yapiliyor\n", + " elif kullanici_girisi == 4: \n", + " koleksiyon_goruntuleme()\n", + " elif kullanici_girisi == 5: \n", + " break\n", + " else:\n", + " print(\"veri girisi yanlis\")\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "36d69534", + "metadata": {}, + "source": [ + "## Question 3: Customer Management System\n", + "### Project Description: This project involves you creating a customer management system that you can use to manage your customers and perform basic transactions.\n", + " This system will have basic functions such as storing customer information, adding new customers, updating customer information, deleting customers and viewing the customer list. \n", + " Here are the basic steps of the project:\n", + "\n", + " 1-Use a dictionary structure to store customer information. Assign a unique customer identification (ID) for each customer and \n", + " associate customer information with this ID. You can use a dictionary containing information such as name, surname, e-mail, phone number for each customer.\n", + "\n", + " 2-Provide a menu where the user can choose the following actions:\n", + "\n", + " •Add new customers\n", + " •Updating customer information\n", + " •Delete customer\n", + " •List all customers\n", + " •Check out\n", + "\n", + " 3-Perform the relevant action according to the user's choice. For example, when adding a new customer, \n", + " get the required information from the user and add a new customer to the dictionary.\n", + "\n", + " 4-When updating customer information, view the current information using the customer ID and save the updated information.\n", + "\n", + " 5-In the customer deletion process, get the customer ID from the user and delete this customer from the dictionary.\n", + "\n", + " 6-In the process of listing all customers, view the list of existing customers.\n", + "\n", + " 7-Repeat the process until the user logs out.\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e36bdfcc", + "metadata": {}, + "outputs": [], + "source": [ + "import random \n", + "from IPython.display import clear_output\n", + "\n", + "customer_info = dict()\n", + "\n", + "def yeni_musteri_ekle():\n", + " id = random.randint(10**4, 10**5 - 1)\n", + " name = input(\"musteri adini giriniz: \") \n", + " surname = input(\"musteri soyadini giriniz: \") \n", + " eposta = input(\"musteri epostasini giriniz: \") \n", + " telno = int(input(\"musteri telno'sunu giriniz: \"))\n", + " customer_info[id] = [name,surname,eposta,telno]\n", + "\n", + "def musteri_bilgilerini_guncelleme():\n", + " customer_id = int(input(\"guncellemek istediginiz musterinin id'sini giriniz: \"))\n", + " option = input(\"hangi bilgiyi guncellemek istiyorsunuz(ad/soyad/e-posta/telefon numarasi)\")\n", + " if \"ad\" == option:\n", + " customer_info[customer_id][0] = input(\"yeni adi giriniz\").lower()\n", + " elif \"soyad\" == option:\n", + " customer_info[customer_id][1] = input(\"yeni soyadi girin\").lower()\n", + " elif \"eposta\" == option:\n", + " customer_info[customer_id][2] = input(\"yeni eposta'yi giriniz\")\n", + " elif \"telno\" == option:\n", + " customer_info[customer_id][3] = int(input(\"yeni telno giriniz: \"))\n", + " else:\n", + " print(\"yanlis giris yapildi\")\n", + "\n", + " print(customer_info)#mevcut durumu gosterme\n", + "\n", + "def tum_musterileri_listeleme():\n", + " clear_output()\n", + " for i,j in customer_info.items():\n", + " print(\"{} numarali musterinin bilgileri {}\".format(i,j))\n", + "\n", + "def musteri_silme():\n", + " print(customer_info)\n", + " customer_id = input(\"silmek istediginiz musterinin idsini giriniz\")\n", + " del customer_info[int(customer_id)]\n", + " return print(\"silme islemi basarili...\")\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "#-------------- algoritma baslangici -----------------------------\n", + "\n", + "while True: \n", + " kullanici_girisi = int(input(\"\"\" yapmak istediginiz islemin numarasini giriniz: \n", + " 1 - yeni musteri ekleme\n", + " 2 - musteri bilgilerini guncelleme\n", + " 3 - musteri silme \n", + " 4 - tum musterileri listeleme \n", + " 5 - cikis yapma \"\"\"))\n", + " if kullanici_girisi == 1: \n", + " yeni_musteri_ekle()\n", + " elif kullanici_girisi == 2: \n", + " musteri_bilgilerini_guncelleme()\n", + " elif kullanici_girisi == 3: \n", + " musteri_silme()\n", + " elif kullanici_girisi == 4: \n", + " tum_musterileri_listeleme()\n", + " elif kullanici_girisi == 5: \n", + " break\n", + " else:\n", + " print(\"veri girisi yanlis\")\n", + "\n", + "\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a736524", + "metadata": {}, + "outputs": [], + "source": [ + "# 2.Hackerrank\n", + "# https://www.hackerrank.com/challenges/list-comprehensions/problem\n", + "# https://www.hackerrank.com/challenges/python-tuples/problem\n", + "# https://www.hackerrank.com/challenges/nested-list/problem (edited) .\n" + ] + } + ], + "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.13.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 245b69caaaccdf8b9ed6235a9488080bb503fa93 Mon Sep 17 00:00:00 2001 From: feyzkoylu <127228399+feyzkoylu@users.noreply.github.com> Date: Fri, 25 Apr 2025 01:34:02 +0200 Subject: [PATCH 2/3] Delete week2.ipynb --- week2.ipynb | 449 ---------------------------------------------------- 1 file changed, 449 deletions(-) delete mode 100644 week2.ipynb diff --git a/week2.ipynb b/week2.ipynb deleted file mode 100644 index ca64aee..0000000 --- a/week2.ipynb +++ /dev/null @@ -1,449 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "b8539b26", - "metadata": {}, - "source": [ - "# **Python_Modul_Week_2**\n", - "## **Question1: Student Grades Processing**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5692826a", - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# You need to write a Python program to process a student's grades. The program needs to perform the following functions:\n", - "# Store information and notes for 10 students using a dictionary. \n", - "# Let each student have their name, surname and grades (Midterm, Final and Oral grades). For example:\n", - "\n", - "students = {\n", - " \"ahmet yilmaz\" : [85,90,78], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Mehmet Demir\" : [92,88,76], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Ayse Kaya\" : [78,89,95], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Zeynep Celik\" : [65,70,80], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Ali Kara\" : [50,60,55], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Fatma Yildiz\" : [88,85,90], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Murat Aydin\" : [72,68,74], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Elif Aksoy\" : [95,90,88], # Midterm: 85, Final: 90, Oral: 78\n", - " \"Hakan Ozyurek\": [45,50,55], # Midterm: 85, Final: 90, Oral: 78\n", - " \"ahmet yilmaz\" : [80,75,82] # Midterm: 85, Final: 90, Oral: 78\n", - "\n", - "}\n" - ] - }, - { - "cell_type": "markdown", - "id": "4d526007", - "metadata": {}, - "source": [ - "### **•1-Calculate each student's GPA and add it to the dictionary.•**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b65b79d4", - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "gpa_dict = {i: \"{:.2f}\".format(sum(students[i])/3) for i in students.keys()}\n", - "print(gpa_dict)" - ] - }, - { - "cell_type": "markdown", - "id": "6f1628bf", - "metadata": {}, - "source": [ - "### **•2-Find the student with the highest GPA and print it on the screen.•**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e46695bb", - "metadata": {}, - "outputs": [], - "source": [ - "for key, value in gpa_dict.items():\n", - " if value == max(gpa_dict.values()):\n", - " print(key)" - ] - }, - { - "cell_type": "markdown", - "id": "8cbf2ee0", - "metadata": {}, - "source": [ - "### **•3- Separate each student's name from their surname and store them in a separate tuple and add them to a list.•**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3920e4da", - "metadata": {}, - "outputs": [], - "source": [ - "studens_information = list()\n", - "for key in students.keys():\n", - " ad, soyad = key.split()\n", - " studens_information.append((ad,soyad))\n", - "\n", - "print(studens_information)" - ] - }, - { - "cell_type": "markdown", - "id": "628d83de", - "metadata": {}, - "source": [ - "### **•4-Sort the names in alphabetical order and print the sorted list on the screen.•**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "926769f0", - "metadata": {}, - "outputs": [], - "source": [ - "print(sorted(students.keys()))" - ] - }, - { - "cell_type": "markdown", - "id": "e0753377", - "metadata": {}, - "source": [ - "### **•5-Keep students with a GPA below 70 in a cluster (set).•**" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d2f9ddfe", - "metadata": {}, - "outputs": [], - "source": [ - "students_with_70_gpa = set()\n", - "for key, value in gpa_dict.items():\n", - " if float(value) <= 70:\n", - " students_with_70_gpa.add(key)\n", - "print(students_with_70_gpa)" - ] - }, - { - "cell_type": "markdown", - "id": "a2cb3a6b", - "metadata": {}, - "source": [ - "## Question 2: Film Library Management System Project\n", - "### Project Description: This project aims to create an application that will help the user manage their movie collection. Users can add, edit, delete movies and view their collection.\n", - "\n", - "Data Structures Used: Dictionaries (to store movies and related information), lists (to display movie collection)\n", - "\n", - "## Basic Functions:\n", - "\n", - "•1-Create a movie data by taking information such as movie name, director, release year and genre from the user and store it in a dictionary.•**\n", - "\n", - "•2-Give the user the option to edit or delete a movie. (For this, a suitable function must be written for whatever data they want to change about the movie.) \n", - "\n", - "•3-Allow the user to view their collection. List all movies or filter by criteria such as genre or year of release.•\n", - "\n", - "•4-Save the movie data in a file and restore this data when you start the program.•\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5ac83a9a", - "metadata": {}, - "outputs": [], - "source": [ - "from IPython.display import clear_output\n", - "movie_information = dict()\n", - "\n", - "\n", - "\n", - "def koleksiyon_goruntuleme():\n", - " clear_output()\n", - " print(\"dosya okuma baslatiliyor ...\\n\")\n", - " print(\"-\"*30)\n", - " dosya_okuma()\n", - " print(\"dosya okuma basarili ...\")\n", - "\n", - "def dosya_yazma():\n", - " with open(\"film_kutuphane.txt\", \"w\") as dosya:\n", - " for i,j in movie_information.items():\n", - " dosya.writelines(\"{}\\t{}\\n\".format(i,j))\n", - " dosya.seek(0) # Okuma yapabilmek için başa sar\n", - " \n", - "def dosya_okuma():\n", - " with open(\"film_kutuphane.txt\", \"r\") as dosya:\n", - " dosya.seek(0)\n", - " print(dosya.read())\n", - "\n", - " # try:\n", - " # dosya = open(\"film_kutuphane.txt\",\"a\")\n", - " # if dosya.tell() != 0:\n", - " # dosya.seek(0)\n", - " # dosya.read()\n", - " # else:\n", - " # dosya.read()\n", - " # except IOError:\n", - " # print(\"dosya okumada bir hata olurstu\")\n", - " # finally:\n", - " # dosya.close()\n", - "\n", - "def film_ekleme():\n", - " clear_output()\n", - " film_adi = input(\"film adi giriniz: \").lower()\n", - " film_yonetmen = input(\"yonetmen adi giriniz: \").lower()\n", - " film_yili = int(input(\"film yilini giriniz: \"))\n", - " film_turu = input(\"film turunu giriniz: \").lower()\n", - " \n", - " movie_information[film_adi] = [film_yonetmen, film_yili, film_turu]\n", - " dosya_yazma()\n", - "\n", - "def film_duzenleme():\n", - " clear_output()\n", - " if \"evet\" == input(\"filmin adini degistirmek isiyormusun?(evet/hayir)?\"):\n", - " degistirilecek_filmin_adi = input(\"hangi filmin adini degistirmek istiyorsun?\").lower()\n", - " yeni_film_adi = input(\"filmin yeni adini giriniz ...\").lower()\n", - "\n", - " if degistirilecek_filmin_adi in movie_information.keys():\n", - " movie_information[yeni_film_adi] = movie_information.pop(degistirilecek_filmin_adi)\n", - " else:\n", - " print(\"Böyle bir film bulunamadı.\")\n", - "\n", - " dosya_yazma()\n", - " dosya_okuma()\n", - "\n", - " if \"evet\" == input(\"film detayini degistirmek istiyormusun?(evet/hayir)?\"):\n", - "\n", - " degistirilecek_filmin_adi = input(\"hangi filmin detayini degistirmek istiyorsunuz?\")\n", - " kullanici_secenegi = input(\"hangi detayi degistirmek istiyorsun(yonetmen, film yili, film turu)\").lower()\n", - "\n", - " if kullanici_secenegi == \"yonetmen\":\n", - " movie_information[degistirilecek_filmin_adi][0] = input(\"yeni yonetmen adini giriniz: \")\n", - " elif kullanici_secenegi == \"filmyili\" or \"film yili\":\n", - " movie_information[degistirilecek_filmin_adi][1] = int(input(\"filmin yilini giriniz\"))\n", - " elif kullanici_secenegi == \"filmturu\" or \"film turu\":\n", - " movie_information[degistirilecek_filmin_adi][2] = input(\"filmin turunu giriniz: \")\n", - " \n", - " dosya_yazma()\n", - " dosya_okuma()\n", - "\n", - "def film_silme():\n", - " if \"evet\" == input(\"koleksiyonda film silmek istiyormusun(evet/hayir)?\").lower():\n", - " silinecek_film_adi = input(\"hangi filmi silmek istiyorsun?\").lower()\n", - " movie_information.pop(silinecek_film_adi)\n", - " print(\"{:<3} film basarili bir sekilde silindi...\".format(silinecek_film_adi))\n", - "\n", - " print(\"koleksiyonun son hali;\\n\")\n", - " dosya_yazma()\n", - " dosya_okuma()\n", - "\n", - " if \"evet\" == input(\"koleksiyondan film detayini silmek istiyormusun(evet/hayir)?\"):\n", - "\n", - " silinece_film = input(\"hangi filmin detayini silmek isiyorsun\")\n", - "\n", - " silinecek_film_detayi = input(\"filmin hangi detayi silmek istiyorsun(yonetmen, film yili, film turu)\").lower()\n", - "\n", - " if silinecek_film_detayi == \"yonetmen\":\n", - " movie_information[silinece_film].pop(0)\n", - " elif silinecek_film_detayi == \"film yili\" or \"film yili\":\n", - " movie_information[silinece_film].pop(1)\n", - " elif silinecek_film_detayi == \"film turu\" or \"filmturu\":\n", - " movie_information[silinece_film].pop(2)\n", - " else:\n", - " print(\"yanlis giris yapildi\")\n", - "\n", - " dosya_yazma()\n", - " dosya_okuma()\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "#-------------- algoritma baslangici -----------------------------\n", - "\n", - "while True: \n", - " kullanici_girisi = int(input(\"\"\" yapmak istediginiz islemin numarasini giriniz(1-5): \n", - " 1 - film ekleme\n", - " 2 - film duzenleme\n", - " 3 - film silme \n", - " 4 - koleksiyon goruntuleme \n", - " 5 - cikis yapma \"\"\"))\n", - " if kullanici_girisi == 1: \n", - " film_ekleme() #en son dosyaya kayit islemi yapiliyor\n", - " elif kullanici_girisi == 2: \n", - " film_duzenleme() #en son dosyaya kayit islemi yapiliyor\n", - " elif kullanici_girisi == 3: \n", - " film_silme() #en son dosyaya kayit islemi yapiliyor\n", - " elif kullanici_girisi == 4: \n", - " koleksiyon_goruntuleme()\n", - " elif kullanici_girisi == 5: \n", - " break\n", - " else:\n", - " print(\"veri girisi yanlis\")\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "36d69534", - "metadata": {}, - "source": [ - "## Question 3: Customer Management System\n", - "### Project Description: This project involves you creating a customer management system that you can use to manage your customers and perform basic transactions.\n", - " This system will have basic functions such as storing customer information, adding new customers, updating customer information, deleting customers and viewing the customer list. \n", - " Here are the basic steps of the project:\n", - "\n", - " 1-Use a dictionary structure to store customer information. Assign a unique customer identification (ID) for each customer and \n", - " associate customer information with this ID. You can use a dictionary containing information such as name, surname, e-mail, phone number for each customer.\n", - "\n", - " 2-Provide a menu where the user can choose the following actions:\n", - "\n", - " •Add new customers\n", - " •Updating customer information\n", - " •Delete customer\n", - " •List all customers\n", - " •Check out\n", - "\n", - " 3-Perform the relevant action according to the user's choice. For example, when adding a new customer, \n", - " get the required information from the user and add a new customer to the dictionary.\n", - "\n", - " 4-When updating customer information, view the current information using the customer ID and save the updated information.\n", - "\n", - " 5-In the customer deletion process, get the customer ID from the user and delete this customer from the dictionary.\n", - "\n", - " 6-In the process of listing all customers, view the list of existing customers.\n", - "\n", - " 7-Repeat the process until the user logs out.\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e36bdfcc", - "metadata": {}, - "outputs": [], - "source": [ - "import random \n", - "from IPython.display import clear_output\n", - "\n", - "customer_info = dict()\n", - "\n", - "def yeni_musteri_ekle():\n", - " id = random.randint(10**4, 10**5 - 1)\n", - " name = input(\"musteri adini giriniz: \") \n", - " surname = input(\"musteri soyadini giriniz: \") \n", - " eposta = input(\"musteri epostasini giriniz: \") \n", - " telno = int(input(\"musteri telno'sunu giriniz: \"))\n", - " customer_info[id] = [name,surname,eposta,telno]\n", - "\n", - "def musteri_bilgilerini_guncelleme():\n", - " customer_id = int(input(\"guncellemek istediginiz musterinin id'sini giriniz: \"))\n", - " option = input(\"hangi bilgiyi guncellemek istiyorsunuz(ad/soyad/e-posta/telefon numarasi)\")\n", - " if \"ad\" == option:\n", - " customer_info[customer_id][0] = input(\"yeni adi giriniz\").lower()\n", - " elif \"soyad\" == option:\n", - " customer_info[customer_id][1] = input(\"yeni soyadi girin\").lower()\n", - " elif \"eposta\" == option:\n", - " customer_info[customer_id][2] = input(\"yeni eposta'yi giriniz\")\n", - " elif \"telno\" == option:\n", - " customer_info[customer_id][3] = int(input(\"yeni telno giriniz: \"))\n", - " else:\n", - " print(\"yanlis giris yapildi\")\n", - "\n", - " print(customer_info)#mevcut durumu gosterme\n", - "\n", - "def tum_musterileri_listeleme():\n", - " clear_output()\n", - " for i,j in customer_info.items():\n", - " print(\"{} numarali musterinin bilgileri {}\".format(i,j))\n", - "\n", - "def musteri_silme():\n", - " print(customer_info)\n", - " customer_id = input(\"silmek istediginiz musterinin idsini giriniz\")\n", - " del customer_info[int(customer_id)]\n", - " return print(\"silme islemi basarili...\")\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "#-------------- algoritma baslangici -----------------------------\n", - "\n", - "while True: \n", - " kullanici_girisi = int(input(\"\"\" yapmak istediginiz islemin numarasini giriniz: \n", - " 1 - yeni musteri ekleme\n", - " 2 - musteri bilgilerini guncelleme\n", - " 3 - musteri silme \n", - " 4 - tum musterileri listeleme \n", - " 5 - cikis yapma \"\"\"))\n", - " if kullanici_girisi == 1: \n", - " yeni_musteri_ekle()\n", - " elif kullanici_girisi == 2: \n", - " musteri_bilgilerini_guncelleme()\n", - " elif kullanici_girisi == 3: \n", - " musteri_silme()\n", - " elif kullanici_girisi == 4: \n", - " tum_musterileri_listeleme()\n", - " elif kullanici_girisi == 5: \n", - " break\n", - " else:\n", - " print(\"veri girisi yanlis\")\n", - "\n", - "\n", - " " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4a736524", - "metadata": {}, - "outputs": [], - "source": [ - "# 2.Hackerrank\n", - "# https://www.hackerrank.com/challenges/list-comprehensions/problem\n", - "# https://www.hackerrank.com/challenges/python-tuples/problem\n", - "# https://www.hackerrank.com/challenges/nested-list/problem (edited) .\n" - ] - } - ], - "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.13.3" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} From 2b9741bb130f99395e783b00d84a8d8de78d4b8b Mon Sep 17 00:00:00 2001 From: feyzkoylu <127228399+feyzkoylu@users.noreply.github.com> Date: Fri, 25 Apr 2025 01:44:44 +0200 Subject: [PATCH 3/3] Add files via upload --- fk_week2.ipynb | 476 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 476 insertions(+) create mode 100644 fk_week2.ipynb diff --git a/fk_week2.ipynb b/fk_week2.ipynb new file mode 100644 index 0000000..52b7f54 --- /dev/null +++ b/fk_week2.ipynb @@ -0,0 +1,476 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b8539b26", + "metadata": {}, + "source": [ + "# **Python_Modul_Week_2**\n", + "## **Question1: Student Grades Processing**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5692826a", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "# You need to write a Python program to process a student's grades. The program needs to perform the following functions:\n", + "# Store information and notes for 10 students using a dictionary. \n", + "# Let each student have their name, surname and grades (Midterm, Final and Oral grades). For example:\n", + "\n", + "students = {\n", + " \"ahmet yilmaz\" : [85,90,78], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Mehmet Demir\" : [92,88,76], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Ayse Kaya\" : [78,89,95], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Zeynep Celik\" : [65,70,80], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Ali Kara\" : [50,60,55], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Fatma Yildiz\" : [88,85,90], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Murat Aydin\" : [72,68,74], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Elif Aksoy\" : [95,90,88], # Midterm: 85, Final: 90, Oral: 78\n", + " \"Hakan Ozyurek\": [45,50,55], # Midterm: 85, Final: 90, Oral: 78\n", + " \"ahmet yilmaz\" : [80,75,82] # Midterm: 85, Final: 90, Oral: 78\n", + "\n", + "}\n" + ] + }, + { + "cell_type": "markdown", + "id": "4d526007", + "metadata": {}, + "source": [ + "### **•1-Calculate each student's GPA and add it to the dictionary.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b65b79d4", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "for key, value in students.items():\n", + " students[key].append(round(sum(students[key])/len(value),2))\n", + "print(students)\n", + "\n", + "\n", + "# gpa_dict = {i: \"{:.2f}\".format(sum(students[i])/3) for i in students.keys()}\n", + "# print(gpa_dict)" + ] + }, + { + "cell_type": "markdown", + "id": "6f1628bf", + "metadata": {}, + "source": [ + "### **•2-Find the student with the highest GPA and print it on the screen.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e46695bb", + "metadata": {}, + "outputs": [], + "source": [ + "max = 0.0\n", + "for i in students.values():\n", + " if max < i[-1]:\n", + " max = i[-1]\n", + "\n", + "for key, value in students.items():\n", + " if max == value[-1]:\n", + " print(key)\n" + ] + }, + { + "cell_type": "markdown", + "id": "8cbf2ee0", + "metadata": {}, + "source": [ + "### **•3- Separate each student's name from their surname and store them in a separate tuple and add them to a list.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3920e4da", + "metadata": {}, + "outputs": [], + "source": [ + "studens_information = list()\n", + "for key in students.keys():\n", + " ad, soyad = key.split()\n", + " studens_information.append((ad,soyad))\n", + "\n", + "print(studens_information)" + ] + }, + { + "cell_type": "markdown", + "id": "628d83de", + "metadata": {}, + "source": [ + "### **•4-Sort the names in alphabetical order and print the sorted list on the screen.•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "926769f0", + "metadata": {}, + "outputs": [], + "source": [ + "print(sorted(students.keys()))" + ] + }, + { + "cell_type": "markdown", + "id": "e0753377", + "metadata": {}, + "source": [ + "### **•5-Keep students with a GPA below 70 in a cluster (set).•**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d2f9ddfe", + "metadata": {}, + "outputs": [], + "source": [ + "students_with_70_gpa = set()\n", + "for key, value in students.items():\n", + " if value[-1] <= 70:\n", + " students_with_70_gpa.add(key)\n", + "print(students_with_70_gpa)" + ] + }, + { + "cell_type": "markdown", + "id": "a2cb3a6b", + "metadata": {}, + "source": [ + "## Question 2: Film Library Management System Project\n", + "### Project Description: This project aims to create an application that will help the user manage their movie collection. Users can add, edit, delete movies and view their collection.\n", + "\n", + "Data Structures Used: Dictionaries (to store movies and related information), lists (to display movie collection)\n", + "\n", + "## Basic Functions:\n", + "\n", + "•1-Create a movie data by taking information such as movie name, director, release year and genre from the user and store it in a dictionary.•**\n", + "\n", + "•2-Give the user the option to edit or delete a movie. (For this, a suitable function must be written for whatever data they want to change about the movie.) \n", + "\n", + "•3-Allow the user to view their collection. List all movies or filter by criteria such as genre or year of release.•\n", + "\n", + "•4-Save the movie data in a file and restore this data when you start the program.•\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ac83a9a", + "metadata": {}, + "outputs": [], + "source": [ + "from IPython.display import clear_output\n", + "movie_information = dict()\n", + "\n", + "\n", + "\n", + "def koleksiyon_goruntuleme():\n", + " clear_output()\n", + " print(\"dosya okuma baslatiliyor ...\\n\")\n", + " print(\"-\"*30)\n", + " dosya_okuma()\n", + " print(\"dosya okuma basarili ...\")\n", + "\n", + "def dosya_yazma():\n", + " with open(\"film_kutuphane.txt\", \"w\") as dosya:\n", + " for i,j in movie_information.items():\n", + " dosya.writelines(\"{}\\t{}\\n\".format(i,j))\n", + " dosya.seek(0) # Okuma yapabilmek için başa sar\n", + " \n", + "def dosya_okuma():\n", + " with open(\"film_kutuphane.txt\", \"r\") as dosya:\n", + " dosya.seek(0)\n", + " print(dosya.read())\n", + "\n", + " # try:\n", + " # dosya = open(\"film_kutuphane.txt\",\"a\")\n", + " # if dosya.tell() != 0:\n", + " # dosya.seek(0)\n", + " # dosya.read()\n", + " # else:\n", + " # dosya.read()\n", + " # except IOError:\n", + " # print(\"dosya okumada bir hata olurstu\")\n", + " # finally:\n", + " # dosya.close()\n", + "\n", + "def film_ekleme():\n", + " clear_output()\n", + " film_adi = input(\"film adi giriniz: \").lower()\n", + " film_yonetmen = input(\"yonetmen adi giriniz: \").lower()\n", + " film_yili = int(input(\"film yilini giriniz: \"))\n", + " film_turu = input(\"film turunu giriniz: \").lower()\n", + " \n", + " movie_information[film_adi] = [film_yonetmen, film_yili, film_turu]\n", + " dosya_yazma()\n", + "\n", + "def film_duzenleme():\n", + " clear_output()\n", + " if \"evet\" == input(\"filmin adini degistirmek isiyormusun?(evet/hayir)?\"):\n", + " degistirilecek_filmin_adi = input(\"hangi filmin adini degistirmek istiyorsun?\").lower()\n", + " yeni_film_adi = input(\"filmin yeni adini giriniz ...\").lower()\n", + "\n", + " if degistirilecek_filmin_adi in movie_information.keys():\n", + " movie_information[yeni_film_adi] = movie_information.pop(degistirilecek_filmin_adi)\n", + " else:\n", + " print(\"Böyle bir film bulunamadı.\")\n", + "\n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + " if \"evet\" == input(\"film detayini degistirmek istiyormusun?(evet/hayir)?\"):\n", + "\n", + " degistirilecek_filmin_adi = input(\"hangi filmin detayini degistirmek istiyorsunuz?\")\n", + " kullanici_secenegi = input(\"hangi detayi degistirmek istiyorsun(yonetmen, film yili, film turu)\").lower()\n", + "\n", + " if kullanici_secenegi == \"yonetmen\":\n", + " movie_information[degistirilecek_filmin_adi][0] = input(\"yeni yonetmen adini giriniz: \")\n", + " elif kullanici_secenegi == \"filmyili\" or \"film yili\":\n", + " movie_information[degistirilecek_filmin_adi][1] = int(input(\"filmin yilini giriniz\"))\n", + " elif kullanici_secenegi == \"filmturu\" or \"film turu\":\n", + " movie_information[degistirilecek_filmin_adi][2] = input(\"filmin turunu giriniz: \")\n", + " \n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + "def film_silme():\n", + " if \"evet\" == input(\"koleksiyonda film silmek istiyormusun(evet/hayir)?\").lower():\n", + " silinecek_film_adi = input(\"hangi filmi silmek istiyorsun?\").lower()\n", + " movie_information.pop(silinecek_film_adi)\n", + " print(\"{:<3} film basarili bir sekilde silindi...\".format(silinecek_film_adi))\n", + "\n", + " print(\"koleksiyonun son hali;\\n\")\n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + " if \"evet\" == input(\"koleksiyondan film detayini silmek istiyormusun(evet/hayir)?\"):\n", + "\n", + " silinece_film = input(\"hangi filmin detayini silmek isiyorsun\")\n", + "\n", + " silinecek_film_detayi = input(\"filmin hangi detayi silmek istiyorsun(yonetmen, film yili, film turu)\").lower()\n", + "\n", + " if silinecek_film_detayi == \"yonetmen\":\n", + " movie_information[silinece_film].pop(0)\n", + " elif silinecek_film_detayi == \"film yili\" or \"film yili\":\n", + " movie_information[silinece_film].pop(1)\n", + " elif silinecek_film_detayi == \"film turu\" or \"filmturu\":\n", + " movie_information[silinece_film].pop(2)\n", + " else:\n", + " print(\"yanlis giris yapildi\")\n", + "\n", + " dosya_yazma()\n", + " dosya_okuma()\n", + "\n", + "def filtreleme():\n", + " filter = input(\"\"\" yapmak istediginiz islemin numarasini giriniz(1-5): \n", + " 1 - film adina gore filtreleme\n", + " 2 - film yonetmenine gore filtreleme\n", + " 3 - film yilina gore filtreleme\n", + " 4 - film turune gore filtreleme \"\"\")\n", + " \n", + " if filter == 1:\n", + " filter_film_ad = input(\"filtrelenecek film adini giriniz: \")\n", + " for i in movie_information.keys():\n", + " if i == filter_film_ad:\n", + " print(\"{}\\t{}\\n\".format(i,movie_information[i]))\n", + " elif filter == 2: \n", + " filter_film_yonetmen = input(\"filtrelenecek yonetmen adini giriniz: \")\n", + " for i, j in movie_information.items():\n", + " if j[0] == filter_film_yonetmen:\n", + " print(\"{}\\t{}\\n\".format(i,j))\n", + " elif filter == 3: \n", + " filter_film_yili = input(\"filtrelenecek film yilini giriniz: \")\n", + " for i,j in movie_information.items():\n", + " if j[1] == int(filter_film_yili):\n", + " print(\"{}\\t{}\\n\".format(i,j))\n", + " elif filter == 4:\n", + " filter_film_turu = input(\"filtrelenecek film turunu giriniz: \")\n", + " for i,j in movie_information.items():\n", + " if j[2] == filter_film_turu:\n", + " print(\"{}\\t{}\\n\".format(i,j))\n", + " else:\n", + " print(\"girilen veriler yanlis\")\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "#-------------- algoritma baslangici -----------------------------\n", + "\n", + "while True: \n", + " kullanici_girisi = int(input(\"\"\" yapmak istediginiz islemin numarasini giriniz(1-5): \n", + " 1 - film ekleme\n", + " 2 - film duzenleme\n", + " 3 - film silme \n", + " 4 - koleksiyon goruntuleme \n", + " 5 - filtreleme\n", + " 6 - cikis yapma \"\"\"))\n", + " if kullanici_girisi == 1: \n", + " film_ekleme() #en son dosyaya kayit islemi yapiliyor\n", + " elif kullanici_girisi == 2: \n", + " film_duzenleme() #en son dosyaya kayit islemi yapiliyor\n", + " elif kullanici_girisi == 3: \n", + " film_silme() #en son dosyaya kayit islemi yapiliyor\n", + " elif kullanici_girisi == 4: \n", + " koleksiyon_goruntuleme()\n", + " elif kullanici_girisi == 5:\n", + " filtreleme()\n", + " elif kullanici_girisi == 6: \n", + " break\n", + " else:\n", + " print(\"veri girisi yanlis\")\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "36d69534", + "metadata": {}, + "source": [ + "## Question 3: Customer Management System\n", + "### Project Description: This project involves you creating a customer management system that you can use to manage your customers and perform basic transactions.\n", + " This system will have basic functions such as storing customer information, adding new customers, updating customer information, deleting customers and viewing the customer list. \n", + " Here are the basic steps of the project:\n", + "\n", + " 1-Use a dictionary structure to store customer information. Assign a unique customer identification (ID) for each customer and \n", + " associate customer information with this ID. You can use a dictionary containing information such as name, surname, e-mail, phone number for each customer.\n", + "\n", + " 2-Provide a menu where the user can choose the following actions:\n", + "\n", + " •Add new customers\n", + " •Updating customer information\n", + " •Delete customer\n", + " •List all customers\n", + " •Check out\n", + "\n", + " 3-Perform the relevant action according to the user's choice. For example, when adding a new customer, \n", + " get the required information from the user and add a new customer to the dictionary.\n", + "\n", + " 4-When updating customer information, view the current information using the customer ID and save the updated information.\n", + "\n", + " 5-In the customer deletion process, get the customer ID from the user and delete this customer from the dictionary.\n", + "\n", + " 6-In the process of listing all customers, view the list of existing customers.\n", + "\n", + " 7-Repeat the process until the user logs out.\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e36bdfcc", + "metadata": {}, + "outputs": [], + "source": [ + "import random \n", + "from IPython.display import clear_output\n", + "\n", + "customer_info = dict()\n", + "\n", + "def yeni_musteri_ekle():\n", + " id = random.randint(10**4, 10**5 - 1)\n", + " name = input(\"musteri adini giriniz: \") \n", + " surname = input(\"musteri soyadini giriniz: \") \n", + " eposta = input(\"musteri epostasini giriniz: \") \n", + " telno = int(input(\"musteri telno'sunu giriniz: \"))\n", + " customer_info[id] = [name,surname,eposta,telno]\n", + " print(customer_info)\n", + "\n", + "def musteri_bilgilerini_guncelleme():\n", + " customer_id = int(input(\"guncellemek istediginiz musterinin id'sini giriniz: \"))\n", + " option = input(\"hangi bilgiyi guncellemek istiyorsunuz(ad/soyad/e-posta/telefon numarasi)\")\n", + " if \"ad\" == option:\n", + " customer_info[customer_id][0] = input(\"yeni adi giriniz\").lower()\n", + " elif \"soyad\" == option:\n", + " customer_info[customer_id][1] = input(\"yeni soyadi girin\").lower()\n", + " elif \"eposta\" == option:\n", + " customer_info[customer_id][2] = input(\"yeni eposta'yi giriniz\")\n", + " elif \"telno\" == option:\n", + " customer_info[customer_id][3] = int(input(\"yeni telno giriniz: \"))\n", + " else:\n", + " print(\"yanlis giris yapildi\")\n", + "\n", + " print(customer_info)#mevcut durumu gosterme\n", + "\n", + "def tum_musterileri_listeleme():\n", + " clear_output()\n", + " for i,j in customer_info.items():\n", + " print(\"{} numarali musterinin bilgileri {}\".format(i,j))\n", + "\n", + "def musteri_silme():\n", + " print(customer_info)\n", + " customer_id = input(\"silmek istediginiz musterinin idsini giriniz\")\n", + " del customer_info[int(customer_id)]\n", + " return print(\"silme islemi basarili...\")\n", + "\n", + "\n", + "\n", + "#-------------- algoritma baslangici -----------------------------\n", + "\n", + "while True: \n", + " kullanici_girisi = int(input(\"\"\" yapmak istediginiz islemin numarasini giriniz: \n", + " 1 - yeni musteri ekleme\n", + " 2 - musteri bilgilerini guncelleme\n", + " 3 - musteri silme \n", + " 4 - tum musterileri listeleme \n", + " 5 - cikis yapma \"\"\"))\n", + " if kullanici_girisi == 1: \n", + " yeni_musteri_ekle()\n", + " elif kullanici_girisi == 2: \n", + " musteri_bilgilerini_guncelleme()\n", + " elif kullanici_girisi == 3: \n", + " musteri_silme()\n", + " elif kullanici_girisi == 4: \n", + " tum_musterileri_listeleme()\n", + " elif kullanici_girisi == 5: \n", + " break\n", + " else:\n", + " print(\"veri girisi yanlis\")\n" + ] + } + ], + "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.13.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}