From 3d6d98f0c1827cd5fea5d57b9b89e1e993a727aa Mon Sep 17 00:00:00 2001 From: filifili Date: Tue, 8 Apr 2025 10:11:22 +0200 Subject: [PATCH 01/10] question 1 is done --- fili_team_member_week_1.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 fili_team_member_week_1.py diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py new file mode 100644 index 0000000..605a229 --- /dev/null +++ b/fili_team_member_week_1.py @@ -0,0 +1,3 @@ +#Python_Modul_Week_1_question_1 +for i in range(1,11): + print(i) \ No newline at end of file From c9659724a56df77b4d5f708e9a8e9967367c9fcc Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 08:28:57 +0200 Subject: [PATCH 02/10] question 2 is done --- fili_team_member_week_1.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 605a229..51ac41c 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,3 +1,14 @@ -#Python_Modul_Week_1_question_1 -for i in range(1,11): - print(i) \ No newline at end of file +#input from the user +num = int(input("Enter a number: ")) + +for i in range(2, num + 1, 2): +# Print every even number + print(i) + +num = int(input("Enter a number: ")) + +print("Even numbers whith while loop:") +i = 2 # Start from 2 +while i <= num: + print(i) + i += 2 # Increasing by 2 From 33226fb79df204edde62adedcaa7c3319e6d19ef Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:00:52 +0200 Subject: [PATCH 03/10] question 3 is done --- fili_team_member_week_1.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 51ac41c..37e70ab 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,14 +1,6 @@ -#input from the user -num = int(input("Enter a number: ")) +#user input for start and end values +start = int(input("Start: ")) +end = int(input("End: ")) -for i in range(2, num + 1, 2): -# Print every even number - print(i) - -num = int(input("Enter a number: ")) - -print("Even numbers whith while loop:") -i = 2 # Start from 2 -while i <= num: - print(i) - i += 2 # Increasing by 2 +for i in range(start, end + 1): + print(i) \ No newline at end of file From 0bed5e1548e2558a19f331007552affee58a1bf0 Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:10:04 +0200 Subject: [PATCH 04/10] question 4 is done --- fili_team_member_week_1.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 37e70ab..2d2bd54 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,6 +1,2 @@ -#user input for start and end values -start = int(input("Start: ")) -end = int(input("End: ")) - -for i in range(start, end + 1): - print(i) \ No newline at end of file +number = int(input("Enter an integer: ")) +print("Even" if number % 2 == 0 else "Odd") \ No newline at end of file From 45d876090accc2d003a20602d8e6346f4dbd1d3d Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:28:16 +0200 Subject: [PATCH 05/10] question 5 is done --- fili_team_member_week_1.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 2d2bd54..0a445e5 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,2 +1,9 @@ -number = int(input("Enter an integer: ")) -print("Even" if number % 2 == 0 else "Odd") \ No newline at end of file +#user input +num=int(input('enter a number:')) + +factorial = 1 + +for i in range(1,num+1): + factorial *=i + +print('factorial:',factorial) \ No newline at end of file From 5d94e0fa8b339960780cf7ac29a21e3854feaf10 Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:33:13 +0200 Subject: [PATCH 06/10] question 8 is done --- fili_team_member_week_1.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 0a445e5..88f5792 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,9 +1,3 @@ -#user input -num=int(input('enter a number:')) - -factorial = 1 - -for i in range(1,num+1): - factorial *=i - -print('factorial:',factorial) \ No newline at end of file +word = input("Enter a word: ") +reversed_word =word[::-1] +print(reversed_word) \ No newline at end of file From 8f32fc2abfa583040d68a45d09ad816986e9bbd8 Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:42:32 +0200 Subject: [PATCH 07/10] question 10 is done --- fili_team_member_week_1.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 88f5792..268bcf5 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,3 +1,14 @@ -word = input("Enter a word: ") -reversed_word =word[::-1] -print(reversed_word) \ No newline at end of file +w = float(input("Weight (kg): ")) +h = float(input("Height (m): ")) +bmi = w / (h ** 2) +#bmi is 'body mass index' formula +print(f"BMI: {bmi:.2f}") + +if bmi < 25: + print("belowweight") +elif bmi < 30: + print("Normal") +elif bmi <= 40: + print("Overweight") +else: + print("Severely overweight") From 4c78c9404beb95858ad469694ba029a3959dfc59 Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:48:55 +0200 Subject: [PATCH 08/10] question 11 is done --- fili_team_member_week_1.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 268bcf5..337a7de 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,14 +1,5 @@ -w = float(input("Weight (kg): ")) -h = float(input("Height (m): ")) -bmi = w / (h ** 2) -#bmi is 'body mass index' formula -print(f"BMI: {bmi:.2f}") - -if bmi < 25: - print("belowweight") -elif bmi < 30: - print("Normal") -elif bmi <= 40: - print("Overweight") -else: - print("Severely overweight") +a = float(input("First: ")) +b = float(input("Second: ")) +c = float(input("Third: ")) +#max(numbers) built-in function +print("Largest:", max(a, b, c)) \ No newline at end of file From 7acd671ff0cf940ac7a1f06eed5f0c6a67100c89 Mon Sep 17 00:00:00 2001 From: filifili Date: Thu, 10 Apr 2025 10:53:56 +0200 Subject: [PATCH 09/10] question 12 is done --- fili_team_member_week_1.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fili_team_member_week_1.py b/fili_team_member_week_1.py index 337a7de..1b02c4b 100644 --- a/fili_team_member_week_1.py +++ b/fili_team_member_week_1.py @@ -1,5 +1,14 @@ -a = float(input("First: ")) -b = float(input("Second: ")) -c = float(input("Third: ")) -#max(numbers) built-in function -print("Largest:", max(a, b, c)) \ No newline at end of file +# Lesson 1: Get Midterm Grade +midterm = float(input("Enter Midterm Grade: ")) + +# Lesson 2: Get Final Grade +final = float(input("Enter Final Grade: ")) + +# Lesson 3: Calculate Year-End Average +average = (0.40 * midterm) + (0.60 * final) + +# Lesson 4: Result +if average < 50: + print("failed") +else: + print("successful") \ No newline at end of file From cc1d031718bb74d156b1e64a1cb50c4acad50841 Mon Sep 17 00:00:00 2001 From: filifili Date: Sat, 19 Apr 2025 00:47:30 +0200 Subject: [PATCH 10/10] question 1 is done --- fili_team_member_week_2.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 fili_team_member_week_2.py diff --git a/fili_team_member_week_2.py b/fili_team_member_week_2.py new file mode 100644 index 0000000..1cb4c8f --- /dev/null +++ b/fili_team_member_week_2.py @@ -0,0 +1,43 @@ +# store a data for 10 students using dictionary. +students = { + 'Ahmet Yilmaz': [85, 90, 78], + 'Mehmet Demir': [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 Öztürk': [45, 50, 55], + 'Canan Taş': [80, 75, 82] +} + +# 1- Calculating each student's GPA and add it to the dictionary. +for name, grades in students.items(): #loop through each student in the students dic. + midterm, final, oral = grades + GPA = (midterm * 0.3) + (final * 0.5) + (oral * 0.2) #calculate the GPA using the given formula + students[name].append(GPA) #To add the caculated GPA to the end of the list of grades + +# 2-To find the student with the highest GPA and print it on the screen +highest_gpa = 0 +best_student = "" +for name, data in students.items(): + if data[3] > highest_gpa: + highest_gpa = data[3] #data[3] GPA that just added(the 4th element) + best_student = name +print(f"Highest GPA: {best_student} ({highest_gpa:.2f})") + +# 3- Separate each student's name from their surname and store them in a separate tuple and add them to a list. +names_list = [(name.split()[0], name.split()[1]) for name in students] #we use list comprehension + +# 4-Sort the names in alphabetical order and print the sorted list on the screen. + +sorted_names = sorted(names_list) #we use built-in fun +print("Sorted Names:", sorted_names) + +# 5-Keep students with a GPA below 70 in a cluster (set). +below = {name for name, data in students.items() if data[3] < 70} +# we use a set comprehension +print("Below 70 GPA:", below) +#if it is,we add the student's full name to the below set and finally print the below set. +