Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions film-library_management_system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# ENG // Question 2: Film Library Management System Project
# 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.
# Data Structures Used: Dictionaries (to store movies and related information), lists (to display movie collection)
# Basic Functions:
# 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.
# 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.)
# 3-Allow the user to view their collection. List all movies or filter by criteria such as genre or year of release.
# 4-Save the movie data in a file and restore this data when you start the program.


#TR//Soru 2: Film Kütüphanesi Yönetim Sistemi Projesi
# Proje Açıklaması: Bu proje, kullanıcının film koleksiyonunu yönetmesine yardımcı olacak bir uygulama oluşturmayı amaçlamaktadır. Kullanıcılar film ekleyebilir, düzenleyebilir, silebilir ve koleksiyonlarını görüntüleyebilir.
# Kullanılan Veri Yapıları: Sözlükler (filmleri ve ilgili bilgileri depolamak için), listeler (film koleksiyonunu görüntülemek için)
# Temel Fonksiyonlar:
# 1-Kullanıcıdan film adı, yönetmeni, yayın yılı, türü gibi bilgileri alarak bir film verisi oluşturun ve bir sözlükte saklayın.
# 2-Kullanıcıya filmi düzenleme veya silme seçeneği verin. (Bunun için, film hakkında değiştirmek istedikleri veriler ne olursa olsun, buna uygun bir fonksiyon yazılmalıdır.)
# 3-Kullanıcının koleksiyonunu görüntülemesine izin verin. Tüm filmleri listeleyin veya tür veya yayın yılı gibi kriterlere göre filtreleyin.
# 4-Film verilerini bir dosyaya kaydedin ve programı başlattığınızda bu verileri geri yükleyin.


#bos bir list olusturdum.
#dictionary = { "key": value}

films = [
{"name": "The Shawshank Redemption", "director": "Frank Darabont", "year": 1994, "genre": "Drama"},
{"name": "The Godfather", "director": "Francis Ford Coppola", "year": 1972, "genre": "Crime, Drama"},
{"name": "The Dark Knight", "director": "Christopher Nolan", "year": 2008, "genre": "Action, Crime, Drama"},
{"name": "Forrest Gump", "director": "Robert Zemeckis", "year": 1994, "genre": "Drama, Romance"},
{"name": "The Lord of the Rings: The Return of the King", "director": "Peter Jackson", "year": 2003, "genre": "Action, Adventure, Fantasy"},
{"name": "Schindler's List", "director": "Steven Spielberg", "year": 1993, "genre": "Biography, Drama, History"},
{"name": "Pulp Fiction", "director": "Quentin Tarantino", "year": 1994, "genre": "Crime, Drama"},
{"name": "The Good, the Bad and the Ugly", "director": "Sergio Leone", "year": 1966, "genre": "Western"},
{"name": "Fight Club", "director": "David Fincher", "year": 1999, "genre": "Drama"},
{"name": "The Matrix", "director": "Lana Wachowski, Lilly Wachowski", "year": 1999, "genre": "Action, Sci-Fi"},
{"name": "Inception", "director": "Christopher Nolan", "year": 2010, "genre": "Action, Adventure, Sci-Fi"},
{"name": "Star Wars: Episode V - The Empire Strikes Back", "director": "Irvin Kershner", "year": 1980, "genre": "Action, Adventure, Fantasy"},
{"name": "Titanic", "director": "James Cameron", "year": 1997, "genre": "Drama, Romance"},
{"name": "The Silence of the Lambs", "director": "Jonathan Demme", "year": 1991, "genre": "Crime, Drama, Thriller"},
{"name": "Avengers: Infinity War", "director": "Anthony Russo, Joe Russo", "year": 2018, "genre": "Action, Adventure, Sci-Fi"}
]



def add_film():
name_ofthe_film = input("Enter the name of the film")
director_ofthe_film = input("Enter the director of the film")
year_ofthe_film = input("Enter the year of the film")
genre_ofthe_film = input("Enter the genre of the film")
films.append({
"name": name_ofthe_film,
"director": director_ofthe_film,
"year": year_ofthe_film,
"genre": genre_ofthe_film
})


def get_films():
for index, film in enumerate(films, 1):
print(f"{index}, Name: {film['name']}, Director: {film['director']}, Year: {film['year']}, Genre: {film['genre']}")
#enumerate
# Python'da enumerate, bir iterable (örneğin bir liste veya tuple) üzerinde döngü yaparken, her elemanla birlikte o elemanın indeksini (sırasını) de elde etmenizi sağlar. Bu, özellikle bir döngüde hem elemanlara hem de indekslere ihtiyaç duyduğunuz durumlarda oldukça kullanışlıdır.

# Sözdizimi
# enumerate(iterable, start=0)
# iterable: Üzerinde döngü yapılacak veri (örneğin liste, tuple, string).
# start: İndeksin başlayacağı sayı (varsayılan 0’dır).

#2//enumerate Olmadan Nasıl Yapılırdı?

# Eğer enumerate kullanmazsanız, bir döngü içinde indeksleri ayrı bir şekilde elde etmeniz gerekirdi:
# def get_films():
# for i in range(len(films)): # range(len(films)) ile indeksleri alıyoruz
# film = films[i] # İlgili indeksin film sözlüğünü alıyoruz
# print(f"{i + 1}. Name: {film['name']}, Director: {film['director']}, Year: {film['year']}, Genre: {film['genre']}")
# Bu da aynı sonucu üretir, ancak enumerate kullanmak daha okunabilir ve Pythonic bir çözümdür.

def find_film():
wanted_film = input("Enter the movie name you want to search: ").lower()
found_films = [film for film in films if wanted_film.lower() in film ['name'].lower()]

if found_films:
for film in found_films:
print(f"Name: {film['name']}, Director: {film['director']}, Year: {film['year']}, Genre: {film['genre']}")
else:
print("The film you are looking for could not be found.")

def delete_film():
name_to_delete = input("Enter the name of the film you want to delete: ").lower()
found = False
for film in films:
if film["name"].lower() == name_to_delete:
films.remove(film)
print(f"The film '{film['name']}' has been deleted.")
found = True
break # İlk bulduğu filmi silip döngüyü sonlandırır
if not found:
print("The film you want to delete was not found.")


#menu
while True:
print("\nFilm library menu\n")
print("1 - Add film")
print("2 - List films")
print("3 - Search for a film")
print("4 - Delete a film")
print("5 - Exit\n")

selected = input("select the operation you want to perform(1/2/3/4/5): ")
if selected == "1":
add_film()
elif selected == "2":
get_films()
elif selected == "3":
find_film()
elif selected == "4":
delete_film()
elif selected == "5":
print("leaving the library...")
break
else:
print("you made an invalid choice ")
102 changes: 102 additions & 0 deletions nesli_week_2/customer_management_system.py.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#Customer Management System
# Project Description: This project involves you creating a customer management system that you can use to manage your customers and perform basic transactions. This system will have basic functions such as storing customer information, adding new customers, updating customer information, deleting customers and viewing the customer list. Here are the basic steps of the project:

# 1-Use a dictionary structure to store customer information. Assign a unique customer identification (ID) for each customer and associate customer information with this ID. You can use a dictionary containing information such as name, surname, e-mail, phone number for each customer.
# 2-Provide a menu where the user can choose the following actions:

# * Add new customers
# * Updating customer information
# * Delete customer
# * List all customers
# * Check out

# 3-Perform the relevant action according to the user's choice. For example, when adding a new customer, get the required information from the user and add a new customer to the dictionary.
# 4-When updating customer information, view the current information using the customer ID and save the updated information.
# 5-In the customer deletion process, get the customer ID from the user and delete this customer from the dictionary.
# 6-In the process of listing all customers, view the list of existing customers.
# 7-Repeat the process until the user logs out.

def customer_management_system():
# Dictionary to store customer information
##glossary/dictionary structure to store customer information
customers = {}

while True:
print("\nCustomer Management System")
print("1. Add New Customer")
print("2. List All Customers")
print("3. Delete Customer")
print("4. Update Customer Information")
print("5. Exit")

selected = input("Select the operation you want to perform (1-5): ").strip()

if selected == "1":
id = input("Customer ID: ").strip()
if not id:
print("ID cannot be empty. Please try again.")
continue
if id in customers:
print("This ID is already in use. Please use a different ID.")
continue

name = input("Customer Name: ").strip()
surname = input("Customer Surname: ").strip()
e_mail = input("Customer Email Address: ").strip()
phone = input("Customer Phone Number: ").strip()

customers[id] = {
"name": name,
"surname": surname,
"e_mail": e_mail,
"phone": phone
}
print(f"Customer {name} {surname} added successfully.")

elif selected == "2":
if not customers:
print("There are no customer records.")
else:
print("\nRegistered Customers:")
for id, information in customers.items():
print(f"ID: {id}, Name: {information['name']}, Surname: {information['surname']}, "
f"Email: {information['e_mail']}, Phone: {information['phone']}")

elif selected == "3":
id = input("The customer ID you want to delete: ").strip()
if id in customers:
del customers[id]
print("Customer successfully deleted.")
else:
print("No customer with this ID was found.")

elif selected == "4":
id = input("Enter the Customer ID you want to update: ").strip()
if id in customers:
print(f"Current Information: Name: {customers[id]['name']}, Surname: {customers[id]['surname']}, "
f"Email: {customers[id]['e_mail']}, Phone: {customers[id]['phone']}")
new_name = input("Enter a new name: ").strip()
new_surname = input("Enter a new surname: ").strip()
new_e_mail = input("Enter a new email address: ").strip()
new_phone = input("Enter a new phone number: ").strip()

customers[id] = {
"name": new_name,
"surname": new_surname,
"e_mail": new_e_mail,
"phone": new_phone
}

print("Customer information updated successfully.")
else:
print("No customer with this ID found.")

elif selected == "5":
print("Exiting...")
break

else:
print("Invalid option. Please try again.")

# Call the function to start the system
customer_management_system()
95 changes: 95 additions & 0 deletions nesli_week_2/student_grades_processing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# ### Question1: Student Grades Processing

# You need to write a Python program to process a student's grades. The program needs to perform the following functions:
# Store information and notes for 10 students using a dictionary. Let each student have their name, surname and grades (Midterm, Final and Oral grades). For example:
# ![image](https://github.com/user-attachments/assets/0e3f85a4-bf24-4b22-b0ea-f9b3dbda4fc8)

# 1-Calculate each student's GPA and add it to the dictionary.
# 2-Find the student with the highest GPA and print it on the screen.
# 3- Separate each student's name from their surname and store them in a separate tuple and add them to a list.
# 4-Sort the names in alphabetical order and print the sorted list on the screen.
# 5-Keep students with a GPA below 70 in a cluster (set).


#TR
# Bir öğrencinin notlarını işlemek için bir Python programı yazmanız gerekiyor. Programın aşağıdaki işlevleri gerçekleştirmesi gerekiyor:
# Bir sözlük kullanarak 10 öğrenci için bilgi ve notları depolayın. Her öğrencinin adını, soyadını ve notlarını
# (Vize, Final ve Sözlü notları) almasını sağlayın. Örneğin:

# 1-Her öğrencinin not ortalamasını hesaplayıp sözlüğe ekleyin.
# 2-En yüksek not ortalamasına sahip öğrenciyi bulup ekrana yazdırın.
# 3- Her öğrencinin adını soyadından ayırıp ayrı bir tuple'da saklayıp bir listeye ekleyin.
# 4-İsimleri alfabetik sıraya göre sıralayın ve sıralanmış listeyi ekrana yazdırın.
# 5-GNO'su 70'in altında olan öğrencileri bir kümede (kümede) tutun.


students = {

'Ahmet yilmaz': {'grades': [85, 90, 78]},
'Mehmet Demir': {'grades': [92, 88,76]},
'Ayse Kaya': {'grades': [78, 89, 95]},
'Zeynep Celik': {'grades': [65, 70, 80]},
'Ali Kara': {'grades': [50, 60, 55]},
'Fatma Yildiz': {'grades': [88, 85, 90]},
'Murat Aydin': {'grades': [72, 68, 74]},
'Elif Aksoy': {'grades': [95, 90, 88]},
'Hakan Ozturk': {'grades': [45, 50, 55]},
'Canan Tas': {'grades': [80, 75, 82]}
}


#1/averages

for student_name, info in students.items():
grades = info['grades']
average = sum(grades) / len(grades) #average
info['average'] = average #ortalama bilgisi ekledik


#2/enyuksekortalamayasahipogrenci

highest_avg = 0
top_student = None

for student_name, info in students.items():
if info['average'] > highest_avg:
highest_avg = info['average']
top_student = student_name
print(f"student with the highest grade point average: {top_student}, average: {highest_avg:.2f}")

#3/ad soyadi ayri ayri tuple olustur

name_surname_list = []
for student_name in students.keys():
first_name, last_name = student_name.split() #ad ve soyadini ayir
name_surname_list.append((first_name, last_name))#tuple olarak ekle


#4 Soru 4: İsimleri alfabetik sıraya göre sıralayın
# ve sıralanmış listeyi ekrana yazdırın
#1)
sorted_names = sorted(name_surname_list, key= lambda x:x[0])
print("sorted list of names" , sorted_names)

#2)
# def get_first_name(name_tuple):
# return name_tuple[0]#tuple'in ilk elemanini doner.
# sorted_names = sorted(name_surname_list, key=get_first_name)
# print("siralanmis _isim_listesi:", sorted_names)
#Sıralama, veri üzerinde düzenli çalışmayı sağlar ve okunabilirliği artırır.
# Nasıl sıralıyoruz?

# Python’un sorted() fonksiyonunu kullanıyoruz.
# Sıralama kriterini belirlemek için key=lambda x: x[0] kullanıyoruz; bu, x[0] ile isimlere göre sıralama yapar.
# Adımlar:

# Listeyi sırala: sorted() ile isimlere göre sırala.


#Soru 5: GNO'su 70'in altında olan öğrencileri bir kümede tutun
low_avg_students =set()

for student_name, info in students.items():
if info['average'] < 70: #GNo su 70 in altinda mi kontrol et
low_avg_students.add(student_name)
print("students with a GPA below 70 :", low_avg_students)