diff --git a/Customer Management System.py b/Customer Management System.py new file mode 100644 index 0000000..4077989 --- /dev/null +++ b/Customer Management System.py @@ -0,0 +1,79 @@ +# Question 1: Use a dictionary structure to store customer info with unique ID +customers = {} + +# Question 2: Provide a menu for user actions +while True: + + print("\n1. Add new customer") + print("2. Update customer") + print("3. Delete customer") + print("4. List all customers") + print("5. Check out (exit)") + + choice = input("Choose an option: ") + + # Question 3: Perform action based on user choice — Add customer + if choice == "1": + customer_id = input("Enter customer ID: ") + first_name = input("Enter first name: ") + last_name = input("Enter last name: ") + email = input("Enter email: ") + phone = input("Enter phone number: ") + + customers[customer_id] = { + "first_name": first_name, + "last_name": last_name, + "email": email, + "phone": phone + } + + print("Customer added!") + + # Question 4: Update customer info using ID + elif choice == "2": + customer_id = input("Enter customer ID to update: ") + if customer_id in customers: + print("Current info:", customers[customer_id]) + first_name = input("New first name: ") + last_name = input("New last name: ") + email = input("New email: ") + phone = input("New phone number: ") + + customers[customer_id] = { + "first_name": first_name, + "last_name": last_name, + "email": email, + "phone": phone + } + print("Customer updated.") + else: + print("Customer not found.") + + # Question 5: Delete customer by ID + elif choice == "3": + customer_id = input("Enter customer ID to Delete: ") + if customer_id in customers: + del customers[customer_id] + print("Customer deleted.") + else: + print("Customer not found!") + + # Question 6: List all customers + elif choice =="4": + if customers: + for customer_id, info in customers.items(): + print("ID:", customer_id) + print("Name:", info["first_name"], info["last_name"]) + print("Email:", info["email"]) + print("Phone:", info["phone"]) + print("-" * 10) + else: + print("No customers yet.") + + # Question 7: Repeat until user logs out + elif choice == "5": + print("Exiting Customer Management System. Goodbye!") + break + + else: + print("Invalid option. Please choose 1–5.") \ No newline at end of file diff --git a/Film Library Management System Project.py b/Film Library Management System Project.py new file mode 100644 index 0000000..a796bd9 --- /dev/null +++ b/Film Library Management System Project.py @@ -0,0 +1,98 @@ +import json + + +# Question 4: Restore the movie data when the program starts +try: + with open("mov.json", "r") as file: + movie_library = json.load(file) +except FileNotFoundError: + movie_library = [] + + + + + +# Question 2: Delete a field from a movie +def delete_movie(movie): + key_to_delete = input("Which field do you want to delete? (e.g., genre): ") + if key_to_delete in movie: + del movie[key_to_delete] + print(f"{key_to_delete} was deleted.") + else: + print("That field does not exist.") + +# Question 3: View the movie collection (all, by genre, or year) +def view_movies(): + choice = input("View all movies (all), by genre (genre), or by year (year)?: ") + if choice == "all": + for m in movie_library: + print(m) + elif choice == "genre": + g = input("Enter genre: ") + for m in movie_library: + if "genre" in m and m["genre"].lower() == g.lower(): + print(m) + elif choice == "year": + y = input("Enter release year: ") + for m in movie_library: + if "Release year" in m and m["Release year"] == y: + print(m) + else: + print("Invalid option.") + +# Question 4: Save the movie data in a file +def save_to_file(): + with open("mov.json", "w") as file: + json.dump(movie_library, file, indent=4) + +# Question 1: Create a movie dictionary with user input +movie = { + "Movie name": input("Enter Movie: "), + "Release year": input("Enter release year: "), + "genre": input("Enter genre: "), + "director": input("Enter director: ") +} +movie_library.append(movie) +save_to_file() +print("First movie saved!") + + +while True: + print("\n Movie Library Menu:") + print("1. Add another movie") + print("2. View movies") + print("3. Delete a field from last added movie") + print("4. Exit") + + action = input("Choose an option: ") + + if action == "1": + new_movie = { + "Movie name": input("Enter Movie: "), + "Release year": input("Enter release year: "), + "genre": input("Enter genre: "), + "director": input("Enter director: ") + } + + + movie_library.append(new_movie) + print("Movie added!") + save_to_file() + + elif action == "2": + view_movies() + + elif action == "3": + if movie_library: + delete_movie(movie_library[-1]) + save_to_file() + else: + print("No movie to delete from.") + + elif action == "4": + print("Goodbye!") + save_to_file() + break + + else: + print("Invalid selection. Try again.") \ No newline at end of file diff --git a/Student Grades Processing.py b/Student Grades Processing.py new file mode 100644 index 0000000..7c965e5 --- /dev/null +++ b/Student Grades Processing.py @@ -0,0 +1,70 @@ +students = { + 'Ahmet Yılmaz': [85, 90, 78], + 'Mehmet Demir': [92, 88, 76], + 'Ayşe Kaya': [78, 89, 95], + 'Zeynep Çelik': [65, 70, 80], + 'Ali Kara': [50, 60, 55], + 'Fatma Yıldız': [88, 85, 90], + 'Murat Aydın': [72, 68, 74], + 'Elif Aksoy': [95, 90, 88], + 'Hakan Öztürk': [45, 50, 55], + 'Canan Taş': [80, 75, 82] +} + +# ---------------------------- +# Question 1: Calculate the GPA of each student +# ---------------------------- +top_student = None +top_gpa = 0 +low_gpa_students = set() # For Q5 + +print("GPAs:\n") +low_gpa_students = set() +for name, grades in students.items(): + gpa=sum(grades)/3 + + + # For Question 2 + if gpa > top_gpa: + top_gpa=gpa + top_student=name + + # For Question 5: Add to set if GPA is below 70 + if gpa < 70: + low_gpa_students.add(name) + print(f"{name}: {gpa:.2f}") + +# ---------------------------- +# Question 2: Print the student with the highest GPA +# ---------------------------- +print("\nTop student is:", top_student) +print("With GPA:", f"{top_gpa:.2f}") + + +# ---------------------------- +# Question 3: Separate names into (first_name, last_name) tuples +# ---------------------------- +name_tuples = [] + +for student in students: + first_name, last_name = student.split() + name_tuples.append((first_name, last_name)) + + +print("\nList of name tuples:") +print(name_tuples) + + +# ---------------------------- +# Question 4: Sort the name tuples alphabetically +# ---------------------------- + +name_tuples.sort() +print("Sorted names:") +print(name_tuples) + +# ---------------------------- +# Question 5: Print students with GPA below 70 (stored in a set) +# ---------------------------- +print("low gpa studnets") +print(low_gpa_students) diff --git a/mov.json b/mov.json new file mode 100644 index 0000000..d1e20d3 --- /dev/null +++ b/mov.json @@ -0,0 +1,8 @@ +[ + { + "Movie name": "Inception", + "Release year": "2010", + "genre": "Action", + "director": "Christopher" + } +] \ No newline at end of file