From 18bc36741245844dbf7830a555854fc7c5033340 Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Thu, 17 Apr 2025 13:21:11 +0200 Subject: [PATCH 1/8] Question #1 part 1 is solved --- zahid_team_leader_question1-1.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 zahid_team_leader_question1-1.py diff --git a/zahid_team_leader_question1-1.py b/zahid_team_leader_question1-1.py new file mode 100644 index 0000000..2af877c --- /dev/null +++ b/zahid_team_leader_question1-1.py @@ -0,0 +1,18 @@ +# Question no 1 +students = { +'Ahmet Yilmaz': [85,90, 78], +'Mehmet emir': [92,88, 76], +'Ayse Kaya': [78,89, 95], +'Zeynep Celik': [65,70, 80], +'Ali Kara': [50,60, 55], +'Fatma Yildiz': [88,85, 90], +'Murat Aydin': [72,68,74], +'Elif Aksoy': [95,90,88], +'Hakan Oztiirk':[45,50,55], +'Canan Tas': [80,75,82] +} +new_dic = {} +for key,values in students.items(): + gpa_each_student = round(sum(values) / len(values), 2) + new_dic.update({key:gpa_each_student}) +print(max(sorted(new_dic.items()), key=lambda x: x[1])); \ No newline at end of file From ccaf66ed58f06eab16fc4fbccb2d770ae2866233 Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Thu, 17 Apr 2025 17:34:58 +0200 Subject: [PATCH 2/8] change file name --- ...m_leader_question1-1.py => zahid_team_leader_question1-to-2.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename zahid_team_leader_question1-1.py => zahid_team_leader_question1-to-2.py (100%) diff --git a/zahid_team_leader_question1-1.py b/zahid_team_leader_question1-to-2.py similarity index 100% rename from zahid_team_leader_question1-1.py rename to zahid_team_leader_question1-to-2.py From fe8d6d26f1f422d305531207810f6bdf97942655 Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Thu, 17 Apr 2025 19:12:18 +0200 Subject: [PATCH 3/8] Qu part 3 solved --- zahid_team_leader_question1-1.py | 18 ------------------ zahid_team_leader_question1-3.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) delete mode 100644 zahid_team_leader_question1-1.py create mode 100644 zahid_team_leader_question1-3.py diff --git a/zahid_team_leader_question1-1.py b/zahid_team_leader_question1-1.py deleted file mode 100644 index 2af877c..0000000 --- a/zahid_team_leader_question1-1.py +++ /dev/null @@ -1,18 +0,0 @@ -# Question no 1 -students = { -'Ahmet Yilmaz': [85,90, 78], -'Mehmet emir': [92,88, 76], -'Ayse Kaya': [78,89, 95], -'Zeynep Celik': [65,70, 80], -'Ali Kara': [50,60, 55], -'Fatma Yildiz': [88,85, 90], -'Murat Aydin': [72,68,74], -'Elif Aksoy': [95,90,88], -'Hakan Oztiirk':[45,50,55], -'Canan Tas': [80,75,82] -} -new_dic = {} -for key,values in students.items(): - gpa_each_student = round(sum(values) / len(values), 2) - new_dic.update({key:gpa_each_student}) -print(max(sorted(new_dic.items()), key=lambda x: x[1])); \ No newline at end of file diff --git a/zahid_team_leader_question1-3.py b/zahid_team_leader_question1-3.py new file mode 100644 index 0000000..749b6e5 --- /dev/null +++ b/zahid_team_leader_question1-3.py @@ -0,0 +1,23 @@ +# Question no 3 +# Separate each student's name from their surname and store them in a separate tuple and add them to a list. + +students = { +'Ahmet Yilmaz': [85,90, 78], +'Mehmet emir': [92,88, 76], +'Ayse Kaya': [78,89, 95], +'Zeynep Celik': [65,70, 80], +'Ali Kara': [50,60, 55], +'Fatma Yildiz': [88,85, 90], +'Murat Aydin': [72,68,74], +'Elif Aksoy': [95,90,88], +'Hakan Oztiirk':[45,50,55], +'Canan Tas': [80,75,82] +} + +name_surname_list = [] + +for full_name in students.keys(): + first_name, last_name = full_name.split() + name_surname_list.append((first_name, last_name)) + +print(name_surname_list) \ No newline at end of file From 8dc4a807e54ad9d16403e07641b6d512c76cad72 Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Thu, 17 Apr 2025 19:18:05 +0200 Subject: [PATCH 4/8] update code --- zahid_team_leader_question1-3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zahid_team_leader_question1-3.py b/zahid_team_leader_question1-3.py index 749b6e5..e9fb5e7 100644 --- a/zahid_team_leader_question1-3.py +++ b/zahid_team_leader_question1-3.py @@ -20,4 +20,4 @@ first_name, last_name = full_name.split() name_surname_list.append((first_name, last_name)) -print(name_surname_list) \ No newline at end of file +print(name_surname_list) \ No newline at end of file From c13f098a3cb107d1f0777ad3da1b4cd50fd1a5ad Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Thu, 17 Apr 2025 19:27:04 +0200 Subject: [PATCH 5/8] Question no 1 part 4 solved --- zahid_team_leader_question1-4.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 zahid_team_leader_question1-4.py diff --git a/zahid_team_leader_question1-4.py b/zahid_team_leader_question1-4.py new file mode 100644 index 0000000..f37f5a5 --- /dev/null +++ b/zahid_team_leader_question1-4.py @@ -0,0 +1,17 @@ +# Question no 1 part 4 +# Sort the names in alphabetical order and print the sorted list on the screen. + +students = { +'Ahmet Yilmaz': [85,90, 78], +'Mehmet emir': [92,88, 76], +'Ayse Kaya': [78,89, 95], +'Zeynep Celik': [65,70, 80], +'Ali Kara': [50,60, 55], +'Fatma Yildiz': [88,85, 90], +'Murat Aydin': [72,68,74], +'Elif Aksoy': [95,90,88], +'Hakan Oztiirk':[45,50,55], +'Canan Tas': [80,75,82] +} + +print(dict(sorted(students.items()))) \ No newline at end of file From 9156ce8cef4776f6552da98a67fe473272b32bca Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Thu, 17 Apr 2025 19:35:13 +0200 Subject: [PATCH 6/8] question 1 part 5 completed --- zahid_team_leader_question1-5.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 zahid_team_leader_question1-5.py diff --git a/zahid_team_leader_question1-5.py b/zahid_team_leader_question1-5.py new file mode 100644 index 0000000..6381b4d --- /dev/null +++ b/zahid_team_leader_question1-5.py @@ -0,0 +1,24 @@ +# Question no 1 part 4 +# Sort the names in alphabetical order and print the sorted list on the screen. + +students = { +'Ahmet Yilmaz': [85,90, 78], +'Mehmet emir': [92,88, 76], +'Ayse Kaya': [78,89, 95], +'Zeynep Celik': [65,70, 80], +'Ali Kara': [50,60, 55], +'Fatma Yildiz': [88,85, 90], +'Murat Aydin': [72,68,74], +'Elif Aksoy': [95,90,88], +'Hakan Oztiirk':[45,50,55], +'Canan Tas': [80,75,82] +} + +gpa_students = set() + +for name, grades in students.items(): + gpa = sum(grades) / len(grades) + if gpa < 70: + gpa_students.add(name) + +print(gpa_students,'\n',type(gpa_students)) \ No newline at end of file From f5b13ab5b7189ecd84e5266767b67489fef26146 Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Fri, 18 Apr 2025 00:13:13 +0200 Subject: [PATCH 7/8] Question 2 is solved --- zahid_team_leader_question2.py | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 zahid_team_leader_question2.py diff --git a/zahid_team_leader_question2.py b/zahid_team_leader_question2.py new file mode 100644 index 0000000..f85fb37 --- /dev/null +++ b/zahid_team_leader_question2.py @@ -0,0 +1,86 @@ +# Question no 1 part 2 +import sys +customers = { + 1001: {"name": "Ahmet", "surname": "Yilmaz", "email": "ahmet.yilmaz@example.com", "phone": "+905301112233"}, + 1002: {"name": "Ayse", "surname": "Kaya", "email": "ayse.kaya@example.com", "phone": "+905301234567"}, + 1003: {"name": "Mehmet", "surname": "Emir", "email": "mehmet.emir@example.com", "phone": "+905306789012"}, + 1004: {"name": "Elif", "surname": "Aksoy", "email": "elif.aksoy@example.com", "phone": "+905308765432"}, + 1005: {"name": "Zeynep", "surname": "Celik", "email": "zeynep.celik@example.com", "phone": "+905309876543"}, + 1006: {"name": "Ali", "surname": "Kara", "email": "ali.kara@example.com", "phone": "+905304445566"}, + 1007: {"name": "Fatma", "surname": "Yildiz", "email": "fatma.yildiz@example.com", "phone": "+905307778899"}, + 1008: {"name": "Murat", "surname": "Aydin", "email": "murat.aydin@example.com", "phone": "+905302223344"}, + 1009: {"name": "Hakan", "surname": "Oztiirk", "email": "hakan.oztiirk@example.com", "phone": "+905305556677"}, + 1010: {"name": "Canan", "surname": "Tas", "email": "canan.tas@example.com", "phone": "+905309999000"} +} + +menu = "Add new customers (Press 1)\nUpdating customer information ( Enter 2 ) \nDelete customer ( Enter 3 )\nList all customers ( Enter 4 )" +print(menu) +menu_choice = 0 +try: + menu_choice = int(input("Select a above numner to perform a action")) +except ValueError: + print("Please enter only numbers") + sys.exit() + +def add_new_customer(): + try: + fname = input("Enter your first name") + sname = input("Enter your sur name") + email = input("Enter your Email") + phone = input("Enter your Phone") + unique_id = max(sorted(customers.items()), key=lambda x: x[0])[0]+1 + customers.update({unique_id:{'name':fname,'surname':sname,'email':email,'phone':phone}}) + return customers + except: + print("There is some error") + +def list_all_customer(): + try: + for customer in customers: + #print(customers[customer]) + print(f"Name: {customers[customer]['name']} {customers[customer]["surname"]} Email: {customers[customer]["email"]} Phone: {customers[customer]["phone"]}") + except: + return "Some Error in User List Printing" + +def update_customer(): + try: + id = int(input("Enter the Customer ID which you want to edit")) + try: + print(f"You are going to Change customer {customers[id]['surname']}") + fname = input(f"Please Enter first name") + sname = input(f"Please Enter sur name") + email = input(f"Please Enter email") + phone = input(f"Please Enter phone") + if fname != "": + customers[id]['name'] = fname + if sname != "": + customers[id]['surname'] = sname + if email != "": + customers[id]['email'] = email + if email != "": + customers[id]['phone'] = phone + list_all_customer() + except: + return "Customer not find" + except ValueError: + return "Please enter numbers only" + +def delete_customer(): + id = int(input("Enter the Customer ID which you want to edit")) + try: + del customers[id] + list_all_customer() + except ValueError: + return "Please enter numbers only" + +def view_customer(): + return list_all_customer() + +if menu_choice == 1: + print(add_new_customer()) +elif menu_choice == 2: + print(update_customer()) +elif menu_choice == 3: + print(delete_customer()) +elif menu_choice == 4: + print(view_customer()) From fd7c3d535b61586a92fa1ea31b287dc38bbe62f7 Mon Sep 17 00:00:00 2001 From: zahidulsilam Date: Fri, 18 Apr 2025 22:40:51 +0200 Subject: [PATCH 8/8] movie project solved --- data.json | 44 ++++++++++++++++++++++++++++++++++++++ zahid_team_leader_movie.py | 26 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 data.json create mode 100644 zahid_team_leader_movie.py diff --git a/data.json b/data.json new file mode 100644 index 0000000..3446fc9 --- /dev/null +++ b/data.json @@ -0,0 +1,44 @@ +[ + { + "title": "Movie 1", + "director": "Steven Spielberg", + "year": 1998, + "genre": "Romance" + }, + { + "title": "Movie 2", + "director": "Guillermo del Toro", + "year": 1995, + "genre": "Drama" + }, + { + "title": "Movie 3", + "director": "Kathryn Bigelow", + "year": 2020, + "genre": "Action" + }, + { + "title": "a", + "director": "a", + "year": 2025, + "genre": "a" + }, + { + "title": "a", + "director": "a", + "year": 2025, + "genre": "a" + }, + { + "title": "Block", + "director": "Buster", + "year": 2020, + "genre": "me" + }, + { + "title": "me", + "director": "me", + "year": 2005, + "genre": "me" + } +] \ No newline at end of file diff --git a/zahid_team_leader_movie.py b/zahid_team_leader_movie.py new file mode 100644 index 0000000..6e6c3fc --- /dev/null +++ b/zahid_team_leader_movie.py @@ -0,0 +1,26 @@ +import json,sys +#save movie data in dictionary +try: + def write_json(new_data, filename='data.json'): + with open(filename,'r+') as file: + file_data = json.load(file) + file_data.append(new_data) + file.seek(0) + return json.dump(file_data, file, indent = 4) + + mname = input("Enter movie name ") + mdirector = input("Enter movie director name ") + myear = int(input("Enter year ")) + genre = input("Enter Genre ") + dic={} + dic.update({"title":mname,"director":mdirector,"year":myear,"genre":genre}) + write_json(dic) + print("Data saved in file and showing data from file") + f = open('data.json') + data = json.load(f) + for i in data: + print(f"{i}\n") + f.close() + sys.exit() +except: + print("Please eneter numbers")