From a184aa0494a4a07feb57dde051dfb84821ed9b49 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Wed, 9 Apr 2025 01:38:15 +0200 Subject: [PATCH 01/20] Question 1 is done. --- mithat_team_leader_week_1.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 mithat_team_leader_week_1.py diff --git a/mithat_team_leader_week_1.py b/mithat_team_leader_week_1.py new file mode 100644 index 0000000..06f7638 --- /dev/null +++ b/mithat_team_leader_week_1.py @@ -0,0 +1,3 @@ +# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. +for i in range(1,11): + print(i) \ No newline at end of file From c818debd04f0d169aadb1ad597049e00782bbe70 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 11 Apr 2025 01:37:53 +0200 Subject: [PATCH 02/20] Question 12 is done --- Pyhton Module Week 1-task 12 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Pyhton Module Week 1-task 12 diff --git a/Pyhton Module Week 1-task 12 b/Pyhton Module Week 1-task 12 new file mode 100644 index 0000000..818e647 --- /dev/null +++ b/Pyhton Module Week 1-task 12 @@ -0,0 +1,15 @@ +# Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. +# If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. +# This printing process is 4 lessons. and the lessons will be written one after the other. +print("Enter info for 4 lessons:\n") +for i in range(1,5): + print("Lesson", i) + lesson = input("Enter lesson name: ") + midterm = float(input("Enter midterm grade: ")) + final = float(input("Enter final grade: ")) + average = midterm * 0.4 + final * 0.6 + if average >= 50: + print(lesson + ": SUCCESSFUL (Average: " + str(average) + ")\n") + else: + print(lesson + ": FAILED (Average: " + str(average) + ")\n") + i = i+ 1 \ No newline at end of file From 71736c0b06202a27fc26723026df538deb62eabf Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 11 Apr 2025 19:21:14 +0200 Subject: [PATCH 03/20] HackerRank task 2 is done --- mithat_team_Phyton _week_1.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 mithat_team_Phyton _week_1.py diff --git a/mithat_team_Phyton _week_1.py b/mithat_team_Phyton _week_1.py new file mode 100644 index 0000000..e008164 --- /dev/null +++ b/mithat_team_Phyton _week_1.py @@ -0,0 +1,8 @@ +n = int(input()) +arr = list(map(int, input().split())) +arr.sort() +arr.reverse() +for num in arr: + if num < arr[0]: + print(num) + break \ No newline at end of file From ad8bfc0afc447b89ac2559076eb801573cbc1cb6 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Sun, 13 Apr 2025 18:50:45 +0200 Subject: [PATCH 04/20] Mithat-PyhtonWeek1Homework Homework is done --- Mithat/HackerRank1 | 6 ++++++ Mithat/HackerRank2 | 10 ++++++++++ Mithat/HackerRank3 | 5 +++++ Mithat/HackerRank4 | 9 +++++++++ Mithat/Question1 | 3 +++ Mithat/Question10 | 19 +++++++++++++++++++ Mithat/Question11 | 11 +++++++++++ Mithat/Question12 | 15 +++++++++++++++ Mithat/Question2 | 15 +++++++++++++++ Mithat/Question3 | 13 +++++++++++++ Mithat/Question4 | 6 ++++++ Mithat/Question5 | 14 ++++++++++++++ Mithat/Question6 | 11 +++++++++++ Mithat/Question7 | 10 ++++++++++ Mithat/Question8 | 6 ++++++ Mithat/Question9 | 6 ++++++ 16 files changed, 159 insertions(+) create mode 100644 Mithat/HackerRank1 create mode 100644 Mithat/HackerRank2 create mode 100644 Mithat/HackerRank3 create mode 100644 Mithat/HackerRank4 create mode 100644 Mithat/Question1 create mode 100644 Mithat/Question10 create mode 100644 Mithat/Question11 create mode 100644 Mithat/Question12 create mode 100644 Mithat/Question2 create mode 100644 Mithat/Question3 create mode 100644 Mithat/Question4 create mode 100644 Mithat/Question5 create mode 100644 Mithat/Question6 create mode 100644 Mithat/Question7 create mode 100644 Mithat/Question8 create mode 100644 Mithat/Question9 diff --git a/Mithat/HackerRank1 b/Mithat/HackerRank1 new file mode 100644 index 0000000..daf4adc --- /dev/null +++ b/Mithat/HackerRank1 @@ -0,0 +1,6 @@ +if __name__ == '__main__': + a = int(input()) + b = int(input()) + print(a+b) + print(a-b) + print(a*b) \ No newline at end of file diff --git a/Mithat/HackerRank2 b/Mithat/HackerRank2 new file mode 100644 index 0000000..3200b20 --- /dev/null +++ b/Mithat/HackerRank2 @@ -0,0 +1,10 @@ +n = int(input()) +arr = list(map(int, input().split())) +arr.sort() +arr.reverse() +for num in arr: + if num < arr[0]: + print(num) + break + + \ No newline at end of file diff --git a/Mithat/HackerRank3 b/Mithat/HackerRank3 new file mode 100644 index 0000000..de3a275 --- /dev/null +++ b/Mithat/HackerRank3 @@ -0,0 +1,5 @@ +n = int(input()) +string="" +for i in range(1,n+1): + string=string+str(i) +print(string) \ No newline at end of file diff --git a/Mithat/HackerRank4 b/Mithat/HackerRank4 new file mode 100644 index 0000000..b65830c --- /dev/null +++ b/Mithat/HackerRank4 @@ -0,0 +1,9 @@ +n = int(input()) +student_marks = {} +for _ in range(n): + name, *line = input().split() + scores = list(map(float, line)) + student_marks[name] = scores +query_name = input() +Average=sum(student_marks[query_name])/3 +print(f"{Average:.2f}") \ No newline at end of file diff --git a/Mithat/Question1 b/Mithat/Question1 new file mode 100644 index 0000000..06f7638 --- /dev/null +++ b/Mithat/Question1 @@ -0,0 +1,3 @@ +# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. +for i in range(1,11): + print(i) \ No newline at end of file diff --git a/Mithat/Question10 b/Mithat/Question10 new file mode 100644 index 0000000..2ce6c84 --- /dev/null +++ b/Mithat/Question10 @@ -0,0 +1,19 @@ +'''- Question 10: Write the code that calculates the person's weight index and returns the result +as underweight, overweight or overweight according to the index value. (You can look on the internet for +the weight index calculation) +To do this, ask the user for their weight and height measurements. weight index +If it is below 25, it is weak, +Between 25-30 is normal, +If you are over 30-40, you are overweight. +If you are over 40, you are overweight. ''' + +mass=float(input("enter your kilogram ")) +height=float(input('enter your height in cm ')) +weightIndex=mass/(height/100)**2 +if weightIndex<25: + print('you are weak') +elif weightIndex<=25<=30: + print('you are normal') +elif weightIndex<=30<=40: + print('you are overweight') +else : print('you are obese') \ No newline at end of file diff --git a/Mithat/Question11 b/Mithat/Question11 new file mode 100644 index 0000000..4118a24 --- /dev/null +++ b/Mithat/Question11 @@ -0,0 +1,11 @@ +# Question 11: How to write a Python program that finds the largest of three numbers entered by a user? +n1=int(input("enter first number ")) +n2=int(input("enter second number ")) +n3=int(input("enter third number ")) +b=n1 +if n1>=n2 and n1>=n3 : + print("biggest number is ", n1) +elif n2>=n1 and n2>=n3 : + print("biggest number is ", n2) +elif n3>=n1 and n3>=n2 : + print("biggest number is ", n3) \ No newline at end of file diff --git a/Mithat/Question12 b/Mithat/Question12 new file mode 100644 index 0000000..3510f93 --- /dev/null +++ b/Mithat/Question12 @@ -0,0 +1,15 @@ +# Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. +# If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. +# This printing process is 4 lessons. and the lessons will be written one after the other. +print("Enter info for 4 lessons:\n") +for i in range(1,5): + print("Lesson", i) + lesson = input("Enter lesson name: ") + midterm = float(input("Enter midterm grade: ")) + final = float(input("Enter final grade: ")) + average = midterm * 0.4 + final * 0.6 + if average >= 50: + print(lesson + ": SUCCESSFUL (Average: " + str(average) + ")\n") + else: + print(lesson + ": FAILED (Average: " + str(average) + ")\n") + i = i+ 1 diff --git a/Mithat/Question2 b/Mithat/Question2 new file mode 100644 index 0000000..f442080 --- /dev/null +++ b/Mithat/Question2 @@ -0,0 +1,15 @@ +n=input("enter a number ") +while not n.isdigit(): + n=input("Please enter a valid number ") +evenNumbers="" +for i in range(0,int(n)+1): + if i%2==0: + evenNumbers = evenNumbers +" "+ str(i) +print("with 'for loop' solution\n",evenNumbers) +evenNumbers="" +j=0 +while j<= int(n): + if j%2==0: + evenNumbers = evenNumbers +" "+ str(j) + j=j+1 +print("with 'while loop' solution\n",evenNumbers) \ No newline at end of file diff --git a/Mithat/Question3 b/Mithat/Question3 new file mode 100644 index 0000000..4399cc1 --- /dev/null +++ b/Mithat/Question3 @@ -0,0 +1,13 @@ +#- Question 3: Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. + +n1=input("enter an integer number as a start ") +while not n1.isdigit(): + n1=input("Please enter an integer number as a start ") +n2=input("enter an integer number as an end number ") +while not n2.isdigit() or int(n2)<=int(n1): + n2=input("Please enter an integer number as a end number ") +numbers="" +for i in range(int(n1),int(n2)+1): + numbers=numbers+" "+str(i) +print("Numbers between",n1, "and",n2,numbers) + diff --git a/Mithat/Question4 b/Mithat/Question4 new file mode 100644 index 0000000..60e11ca --- /dev/null +++ b/Mithat/Question4 @@ -0,0 +1,6 @@ +n=input("enter a number ") +while not n.isdigit(): + n=input("Please enter a valid number ") +if int(n)%2==0: + print("Entered number",n,"is an even number") +else: print("Entered number",n,"is an odd number") diff --git a/Mithat/Question5 b/Mithat/Question5 new file mode 100644 index 0000000..dd84dc0 --- /dev/null +++ b/Mithat/Question5 @@ -0,0 +1,14 @@ +'''- Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers +between a number itself and 1. For example: if the user entered 5, the program should give the following output: + Enter a number from the user: 5 + Factorial: 120 ''' + +n=input("enter a positive number ") +while not n.isdigit() or int(n)<1: + n=input("Please enter a valid positive number ") +factorial=1 +i=1 +while i <=int(n): + factorial=factorial*i + i=i+1 +print("factorial: ", factorial) diff --git a/Mithat/Question6 b/Mithat/Question6 new file mode 100644 index 0000000..c286a56 --- /dev/null +++ b/Mithat/Question6 @@ -0,0 +1,11 @@ +#Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. +n=input("Enter a valid integer number") +j=0 +if int(n)==1: print("entered number is not a prime number") +else: + for i in range(2,10): + if int(n)% int(i) ==0: + j+=1 + if j>2 : print("entered number is not a prime number") + elif j==2 : print("entered number is a prime number") + else: print("entered number is a prime number") \ No newline at end of file diff --git a/Mithat/Question7 b/Mithat/Question7 new file mode 100644 index 0000000..d4a3c78 --- /dev/null +++ b/Mithat/Question7 @@ -0,0 +1,10 @@ +n1=int(input("Enter first number for Fibonacci Sequance ") ) +n2=int(input("Enter second number for Fibonacci Sequance ") ) +limit=int(input("Enter limit number for Fibonacci Sequance ") ) +list=[n1,n2] +while (int(n1)+int(n2)) Date: Sun, 13 Apr 2025 20:42:45 +0200 Subject: [PATCH 05/20] Delete mithat_team_Phyton _week_1.py --- mithat_team_Phyton _week_1.py | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 mithat_team_Phyton _week_1.py diff --git a/mithat_team_Phyton _week_1.py b/mithat_team_Phyton _week_1.py deleted file mode 100644 index e008164..0000000 --- a/mithat_team_Phyton _week_1.py +++ /dev/null @@ -1,8 +0,0 @@ -n = int(input()) -arr = list(map(int, input().split())) -arr.sort() -arr.reverse() -for num in arr: - if num < arr[0]: - print(num) - break \ No newline at end of file From 9cca29b7ea5866d6870296ede964b52061b21fea Mon Sep 17 00:00:00 2001 From: mithat720 Date: Sun, 13 Apr 2025 20:43:04 +0200 Subject: [PATCH 06/20] Delete mithat_team_leader_week_1.py --- mithat_team_leader_week_1.py | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 mithat_team_leader_week_1.py diff --git a/mithat_team_leader_week_1.py b/mithat_team_leader_week_1.py deleted file mode 100644 index 06f7638..0000000 --- a/mithat_team_leader_week_1.py +++ /dev/null @@ -1,3 +0,0 @@ -# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. -for i in range(1,11): - print(i) \ No newline at end of file From 46cff187ca10aafce8add562776a7415fb5b6faf Mon Sep 17 00:00:00 2001 From: mithat720 Date: Sun, 13 Apr 2025 20:43:18 +0200 Subject: [PATCH 07/20] Delete Pyhton Module Week 1-task 12 --- Pyhton Module Week 1-task 12 | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 Pyhton Module Week 1-task 12 diff --git a/Pyhton Module Week 1-task 12 b/Pyhton Module Week 1-task 12 deleted file mode 100644 index 818e647..0000000 --- a/Pyhton Module Week 1-task 12 +++ /dev/null @@ -1,15 +0,0 @@ -# Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. -# If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. -# This printing process is 4 lessons. and the lessons will be written one after the other. -print("Enter info for 4 lessons:\n") -for i in range(1,5): - print("Lesson", i) - lesson = input("Enter lesson name: ") - midterm = float(input("Enter midterm grade: ")) - final = float(input("Enter final grade: ")) - average = midterm * 0.4 + final * 0.6 - if average >= 50: - print(lesson + ": SUCCESSFUL (Average: " + str(average) + ")\n") - else: - print(lesson + ": FAILED (Average: " + str(average) + ")\n") - i = i+ 1 \ No newline at end of file From 8a4d5909321052054efc477a7b5007d3fa48e542 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Sun, 13 Apr 2025 20:46:26 +0200 Subject: [PATCH 08/20] Question 10 changed --- Mithat/Question10 | 10 +--------- Mithat/Question2 | 1 + Mithat/Question3 | 3 +-- Mithat/Question4 | 3 ++- Mithat/Question5 | 10 +++++----- Mithat/Question7 | 1 + Mithat/Question8 | 7 ++----- Mithat/Question9 | 1 + 8 files changed, 14 insertions(+), 22 deletions(-) diff --git a/Mithat/Question10 b/Mithat/Question10 index 2ce6c84..2c427d1 100644 --- a/Mithat/Question10 +++ b/Mithat/Question10 @@ -1,11 +1,3 @@ -'''- Question 10: Write the code that calculates the person's weight index and returns the result -as underweight, overweight or overweight according to the index value. (You can look on the internet for -the weight index calculation) -To do this, ask the user for their weight and height measurements. weight index -If it is below 25, it is weak, -Between 25-30 is normal, -If you are over 30-40, you are overweight. -If you are over 40, you are overweight. ''' mass=float(input("enter your kilogram ")) height=float(input('enter your height in cm ')) @@ -16,4 +8,4 @@ elif weightIndex<=25<=30: print('you are normal') elif weightIndex<=30<=40: print('you are overweight') -else : print('you are obese') \ No newline at end of file +else : print('you are obese') diff --git a/Mithat/Question2 b/Mithat/Question2 index f442080..5fb340a 100644 --- a/Mithat/Question2 +++ b/Mithat/Question2 @@ -1,3 +1,4 @@ +#Question 2: Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. n=input("enter a number ") while not n.isdigit(): n=input("Please enter a valid number ") diff --git a/Mithat/Question3 b/Mithat/Question3 index 4399cc1..465b2e5 100644 --- a/Mithat/Question3 +++ b/Mithat/Question3 @@ -9,5 +9,4 @@ while not n2.isdigit() or int(n2)<=int(n1): numbers="" for i in range(int(n1),int(n2)+1): numbers=numbers+" "+str(i) -print("Numbers between",n1, "and",n2,numbers) - +print("Numbers between",n1, "and",n2,numbers) \ No newline at end of file diff --git a/Mithat/Question4 b/Mithat/Question4 index 60e11ca..993b48f 100644 --- a/Mithat/Question4 +++ b/Mithat/Question4 @@ -1,6 +1,7 @@ +#Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even n=input("enter a number ") while not n.isdigit(): n=input("Please enter a valid number ") if int(n)%2==0: print("Entered number",n,"is an even number") -else: print("Entered number",n,"is an odd number") +else: print("Entered number",n,"is an odd number") \ No newline at end of file diff --git a/Mithat/Question5 b/Mithat/Question5 index dd84dc0..60cd648 100644 --- a/Mithat/Question5 +++ b/Mithat/Question5 @@ -1,7 +1,7 @@ -'''- Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers -between a number itself and 1. For example: if the user entered 5, the program should give the following output: - Enter a number from the user: 5 - Factorial: 120 ''' +#Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. +#For example: if the user entered 5, the program should give the following output: +#Enter a number from the user: 5 +#Factorial: 120 n=input("enter a positive number ") while not n.isdigit() or int(n)<1: @@ -11,4 +11,4 @@ i=1 while i <=int(n): factorial=factorial*i i=i+1 -print("factorial: ", factorial) +print("factorial: ", factorial) \ No newline at end of file diff --git a/Mithat/Question7 b/Mithat/Question7 index d4a3c78..7c32311 100644 --- a/Mithat/Question7 +++ b/Mithat/Question7 @@ -1,3 +1,4 @@ +#Question 7: How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? n1=int(input("Enter first number for Fibonacci Sequance ") ) n2=int(input("Enter second number for Fibonacci Sequance ") ) limit=int(input("Enter limit number for Fibonacci Sequance ") ) diff --git a/Mithat/Question8 b/Mithat/Question8 index 2b76bfc..f801211 100644 --- a/Mithat/Question8 +++ b/Mithat/Question8 @@ -1,6 +1,3 @@ -'''word=input('enter a word') -for i in word: - reverse=word[::-1] -print(reverse)''' + #Question 8: Write a Python code that takes a word from the user and prints the reverse of this word on the screen. -print(input("word: ")[::-1]) \ No newline at end of file +print(input("word: ")[::-1]) \ No newline at end of file diff --git a/Mithat/Question9 b/Mithat/Question9 index 7ad675d..498fa8c 100644 --- a/Mithat/Question9 +++ b/Mithat/Question9 @@ -1,3 +1,4 @@ + #Question 9: How to create a combination of loop and conditional statement that takes a word input from the user and checks whether that word is a palindrome (the same when read backwards)? word=input('enter a word ') for i in word: reverse=word[::-1] From 0b39dc36505eeca39f472eab2cf9cd0a9bc5a4a6 Mon Sep 17 00:00:00 2001 From: icubuk Date: Wed, 16 Apr 2025 19:04:55 +0200 Subject: [PATCH 09/20] Create icubuk --- icubuk | 1 + 1 file changed, 1 insertion(+) create mode 100644 icubuk diff --git a/icubuk b/icubuk new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/icubuk @@ -0,0 +1 @@ + From 244dbcb3fe9a9ba205868b8d10366e9fefb468b2 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Thu, 17 Apr 2025 13:14:37 +0200 Subject: [PATCH 10/20] Update Question6 Question 6 is updated --- Mithat/Question6 | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Mithat/Question6 b/Mithat/Question6 index c286a56..6b70967 100644 --- a/Mithat/Question6 +++ b/Mithat/Question6 @@ -1,11 +1,24 @@ -#Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. -n=input("Enter a valid integer number") -j=0 -if int(n)==1: print("entered number is not a prime number") + +#Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. + +n=input("Enter a valid integer number ") + +if int(n)==1: print("entered number is not a prime number") + else: - for i in range(2,10): - if int(n)% int(i) ==0: - j+=1 - if j>2 : print("entered number is not a prime number") - elif j==2 : print("entered number is a prime number") - else: print("entered number is a prime number") \ No newline at end of file + if 2<=int(n)<=10: + j=0 + for i in range(1,10): + if int(n)% int(i) ==0: + j=j+1 + + if j==2 : print("entered number is a prime number") + else: print("entered number is NOT a prime number") + else: + j=2 + for i in range(1, 10): + if int(n) % int(i) == 0: + j = j + 1 + + if j == 2: print("entered number is a prime number") + else: print("entered number is NOT a prime number") \ No newline at end of file From 4840bc084a01cf4e9fc634b2b07dcef2ed76b662 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Thu, 17 Apr 2025 19:33:19 +0200 Subject: [PATCH 11/20] Update HackerRank2 Hacker Rank 2 is updated --- Mithat/HackerRank2 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mithat/HackerRank2 b/Mithat/HackerRank2 index 3200b20..9a5528d 100644 --- a/Mithat/HackerRank2 +++ b/Mithat/HackerRank2 @@ -1,5 +1,4 @@ -n = int(input()) -arr = list(map(int, input().split())) +arr=[2,3,6,6,5] arr.sort() arr.reverse() for num in arr: From c54d35cd91e30b5eb9ec16da81da27366815f5d8 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Thu, 17 Apr 2025 20:30:22 +0200 Subject: [PATCH 12/20] Update Question6 --- Mithat/Question6 | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Mithat/Question6 b/Mithat/Question6 index 6b70967..826aeb6 100644 --- a/Mithat/Question6 +++ b/Mithat/Question6 @@ -6,19 +6,12 @@ n=input("Enter a valid integer number ") if int(n)==1: print("entered number is not a prime number") else: - if 2<=int(n)<=10: + if 2<=int(n): j=0 - for i in range(1,10): + for i in range(1,int(n)+1): if int(n)% int(i) ==0: j=j+1 if j==2 : print("entered number is a prime number") else: print("entered number is NOT a prime number") - else: - j=2 - for i in range(1, 10): - if int(n) % int(i) == 0: - j = j + 1 - - if j == 2: print("entered number is a prime number") - else: print("entered number is NOT a prime number") \ No newline at end of file + \ No newline at end of file From 0537bd3e5b36350ef7353790dfdd25b5e76a5cde Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 13:54:08 +0200 Subject: [PATCH 13/20] Revert "Create icubuk" This reverts commit 0b39dc36505eeca39f472eab2cf9cd0a9bc5a4a6. --- icubuk | 1 - 1 file changed, 1 deletion(-) delete mode 100644 icubuk diff --git a/icubuk b/icubuk deleted file mode 100644 index 8b13789..0000000 --- a/icubuk +++ /dev/null @@ -1 +0,0 @@ - From 33c2a422c0bf68f33fceab7c1db544d4cd9ae89d Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 13:58:08 +0200 Subject: [PATCH 14/20] Delete icubuk --- icubuk | 1 - 1 file changed, 1 deletion(-) delete mode 100644 icubuk diff --git a/icubuk b/icubuk deleted file mode 100644 index 8b13789..0000000 --- a/icubuk +++ /dev/null @@ -1 +0,0 @@ - From 834155b9f9a484e99ed05ff7a8fcd24b13a92476 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 18:23:57 +0200 Subject: [PATCH 15/20] Python Week-1 Team-3 Homework Python Week-1 Team-3 Homework --- Mithat/HackerRank1 | 6 ---- Mithat/HackerRank2 | 9 ------ Mithat/HackerRank3 | 5 --- Mithat/HackerRank4 | 9 ------ Mithat/Question1 | 3 -- Mithat/Question10 | 11 ------- Mithat/Question11 | 11 ------- Mithat/Question12 | 15 --------- Mithat/Question2 | 16 ---------- Mithat/Question3 | 12 ------- Mithat/Question4 | 7 ---- Mithat/Question5 | 14 -------- Mithat/Question6 | 17 ---------- Mithat/Question7 | 11 ------- Mithat/Question8 | 3 -- Mithat/Question9 | 7 ---- Python_Modul_Week1-Sumeyra_team3_w1.zip | Bin 0 -> 7592 bytes .../Question1.py | 5 +++ .../Question10.py | 17 ++++++++++ .../Question11.py | 16 ++++++++++ .../Question12.py | 15 +++++++++ .../Question2.py | 17 ++++++++++ .../Question3.py | 6 ++++ .../Question4.py | 6 ++++ .../Question5.py | 7 ++++ .../Question6.py | 16 ++++++++++ .../Question7.py | 9 ++++++ .../Question8.py | 4 +++ .../Question9.py | 8 +++++ VIT-7 Week-1 Python-Homework-Team-3/README.md | 30 ++++++++++++++++++ 30 files changed, 156 insertions(+), 156 deletions(-) delete mode 100644 Mithat/HackerRank1 delete mode 100644 Mithat/HackerRank2 delete mode 100644 Mithat/HackerRank3 delete mode 100644 Mithat/HackerRank4 delete mode 100644 Mithat/Question1 delete mode 100644 Mithat/Question10 delete mode 100644 Mithat/Question11 delete mode 100644 Mithat/Question12 delete mode 100644 Mithat/Question2 delete mode 100644 Mithat/Question3 delete mode 100644 Mithat/Question4 delete mode 100644 Mithat/Question5 delete mode 100644 Mithat/Question6 delete mode 100644 Mithat/Question7 delete mode 100644 Mithat/Question8 delete mode 100644 Mithat/Question9 create mode 100644 Python_Modul_Week1-Sumeyra_team3_w1.zip create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question1.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question10.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question11.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question12.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question2.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question3.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question4.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question5.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question6.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question7.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question8.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question9.py create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/README.md diff --git a/Mithat/HackerRank1 b/Mithat/HackerRank1 deleted file mode 100644 index daf4adc..0000000 --- a/Mithat/HackerRank1 +++ /dev/null @@ -1,6 +0,0 @@ -if __name__ == '__main__': - a = int(input()) - b = int(input()) - print(a+b) - print(a-b) - print(a*b) \ No newline at end of file diff --git a/Mithat/HackerRank2 b/Mithat/HackerRank2 deleted file mode 100644 index 9a5528d..0000000 --- a/Mithat/HackerRank2 +++ /dev/null @@ -1,9 +0,0 @@ -arr=[2,3,6,6,5] -arr.sort() -arr.reverse() -for num in arr: - if num < arr[0]: - print(num) - break - - \ No newline at end of file diff --git a/Mithat/HackerRank3 b/Mithat/HackerRank3 deleted file mode 100644 index de3a275..0000000 --- a/Mithat/HackerRank3 +++ /dev/null @@ -1,5 +0,0 @@ -n = int(input()) -string="" -for i in range(1,n+1): - string=string+str(i) -print(string) \ No newline at end of file diff --git a/Mithat/HackerRank4 b/Mithat/HackerRank4 deleted file mode 100644 index b65830c..0000000 --- a/Mithat/HackerRank4 +++ /dev/null @@ -1,9 +0,0 @@ -n = int(input()) -student_marks = {} -for _ in range(n): - name, *line = input().split() - scores = list(map(float, line)) - student_marks[name] = scores -query_name = input() -Average=sum(student_marks[query_name])/3 -print(f"{Average:.2f}") \ No newline at end of file diff --git a/Mithat/Question1 b/Mithat/Question1 deleted file mode 100644 index 06f7638..0000000 --- a/Mithat/Question1 +++ /dev/null @@ -1,3 +0,0 @@ -# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. -for i in range(1,11): - print(i) \ No newline at end of file diff --git a/Mithat/Question10 b/Mithat/Question10 deleted file mode 100644 index 2c427d1..0000000 --- a/Mithat/Question10 +++ /dev/null @@ -1,11 +0,0 @@ - -mass=float(input("enter your kilogram ")) -height=float(input('enter your height in cm ')) -weightIndex=mass/(height/100)**2 -if weightIndex<25: - print('you are weak') -elif weightIndex<=25<=30: - print('you are normal') -elif weightIndex<=30<=40: - print('you are overweight') -else : print('you are obese') diff --git a/Mithat/Question11 b/Mithat/Question11 deleted file mode 100644 index 4118a24..0000000 --- a/Mithat/Question11 +++ /dev/null @@ -1,11 +0,0 @@ -# Question 11: How to write a Python program that finds the largest of three numbers entered by a user? -n1=int(input("enter first number ")) -n2=int(input("enter second number ")) -n3=int(input("enter third number ")) -b=n1 -if n1>=n2 and n1>=n3 : - print("biggest number is ", n1) -elif n2>=n1 and n2>=n3 : - print("biggest number is ", n2) -elif n3>=n1 and n3>=n2 : - print("biggest number is ", n3) \ No newline at end of file diff --git a/Mithat/Question12 b/Mithat/Question12 deleted file mode 100644 index 3510f93..0000000 --- a/Mithat/Question12 +++ /dev/null @@ -1,15 +0,0 @@ -# Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. -# If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. -# This printing process is 4 lessons. and the lessons will be written one after the other. -print("Enter info for 4 lessons:\n") -for i in range(1,5): - print("Lesson", i) - lesson = input("Enter lesson name: ") - midterm = float(input("Enter midterm grade: ")) - final = float(input("Enter final grade: ")) - average = midterm * 0.4 + final * 0.6 - if average >= 50: - print(lesson + ": SUCCESSFUL (Average: " + str(average) + ")\n") - else: - print(lesson + ": FAILED (Average: " + str(average) + ")\n") - i = i+ 1 diff --git a/Mithat/Question2 b/Mithat/Question2 deleted file mode 100644 index 5fb340a..0000000 --- a/Mithat/Question2 +++ /dev/null @@ -1,16 +0,0 @@ -#Question 2: Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. -n=input("enter a number ") -while not n.isdigit(): - n=input("Please enter a valid number ") -evenNumbers="" -for i in range(0,int(n)+1): - if i%2==0: - evenNumbers = evenNumbers +" "+ str(i) -print("with 'for loop' solution\n",evenNumbers) -evenNumbers="" -j=0 -while j<= int(n): - if j%2==0: - evenNumbers = evenNumbers +" "+ str(j) - j=j+1 -print("with 'while loop' solution\n",evenNumbers) \ No newline at end of file diff --git a/Mithat/Question3 b/Mithat/Question3 deleted file mode 100644 index 465b2e5..0000000 --- a/Mithat/Question3 +++ /dev/null @@ -1,12 +0,0 @@ -#- Question 3: Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. - -n1=input("enter an integer number as a start ") -while not n1.isdigit(): - n1=input("Please enter an integer number as a start ") -n2=input("enter an integer number as an end number ") -while not n2.isdigit() or int(n2)<=int(n1): - n2=input("Please enter an integer number as a end number ") -numbers="" -for i in range(int(n1),int(n2)+1): - numbers=numbers+" "+str(i) -print("Numbers between",n1, "and",n2,numbers) \ No newline at end of file diff --git a/Mithat/Question4 b/Mithat/Question4 deleted file mode 100644 index 993b48f..0000000 --- a/Mithat/Question4 +++ /dev/null @@ -1,7 +0,0 @@ -#Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even -n=input("enter a number ") -while not n.isdigit(): - n=input("Please enter a valid number ") -if int(n)%2==0: - print("Entered number",n,"is an even number") -else: print("Entered number",n,"is an odd number") \ No newline at end of file diff --git a/Mithat/Question5 b/Mithat/Question5 deleted file mode 100644 index 60cd648..0000000 --- a/Mithat/Question5 +++ /dev/null @@ -1,14 +0,0 @@ -#Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. -#For example: if the user entered 5, the program should give the following output: -#Enter a number from the user: 5 -#Factorial: 120 - -n=input("enter a positive number ") -while not n.isdigit() or int(n)<1: - n=input("Please enter a valid positive number ") -factorial=1 -i=1 -while i <=int(n): - factorial=factorial*i - i=i+1 -print("factorial: ", factorial) \ No newline at end of file diff --git a/Mithat/Question6 b/Mithat/Question6 deleted file mode 100644 index 826aeb6..0000000 --- a/Mithat/Question6 +++ /dev/null @@ -1,17 +0,0 @@ - -#Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. - -n=input("Enter a valid integer number ") - -if int(n)==1: print("entered number is not a prime number") - -else: - if 2<=int(n): - j=0 - for i in range(1,int(n)+1): - if int(n)% int(i) ==0: - j=j+1 - - if j==2 : print("entered number is a prime number") - else: print("entered number is NOT a prime number") - \ No newline at end of file diff --git a/Mithat/Question7 b/Mithat/Question7 deleted file mode 100644 index 7c32311..0000000 --- a/Mithat/Question7 +++ /dev/null @@ -1,11 +0,0 @@ -#Question 7: How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? -n1=int(input("Enter first number for Fibonacci Sequance ") ) -n2=int(input("Enter second number for Fibonacci Sequance ") ) -limit=int(input("Enter limit number for Fibonacci Sequance ") ) -list=[n1,n2] -while (int(n1)+int(n2))4d4lPY=H1suI40F|go5KC4DgMo;U&WB7 zB#|%IUo^#T216Jj5OA2WBLeF1r(q4S9UHJyTV4UEpvLSwPEle~t&{e(W{M~IIjc%JsPNJGMR`Ra9@RaO= zDKwu*eT@AusY#_k`u5UKCAbl253B#x3^a!bQlu5;7172dr;ZgZ4_jtg+r2{-@=##6_MNC9XY-(p|i7C!QHck2uZhbLjqC&24 zQmsmVHb)+*F_M$zY(`Qyd-k7CyynN6<34Q|?u3P2P|xxCQQ%RB&z+sa*SE#sT7Uw!6?<#QOl{oSRSaeos?;gSbX&?&Y1&fKlm^poI$rdKp}nF z&q{h~s?n2Biva!;i}oP};RmcERu>BXQR;V5KSgY`kgVdxCiIu zb^AE(&m6vg`@G6iCsKPZjH$D4$Jo^Igo&))&HcM+!7QOtVSvmz|MxZ}I-nH@Yy3Iy zx`PT9t&WxxAmRIa?i!}>aOZ*XLxpvo7@kK>#NY~W+!n{uroGQE3{Ufaz8BqCNZ%%Tc611 zw!AsmFiSB{{1hT3ZT0G6Yi#lhrzA#Ohh)+7YDEeWc2Gk4#@$4+PwVj+^;l*Lu@Q8i zT!W>zr3};_(Q(|&k#N)szN_X2iknz?Gm6c6`?Q;Ge32)*R}m;TqPvaB=Mu6Zm!{_! zam}*zOR6e{ld*7AJ#80wt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ieqHsO!kp6<-H?>dEb5AI8|P7RX$c}lGFX1FT_Gx71VM zGBB0fG6rwWcE82Ai)xpr+hT`pP1Q_6CYHe?sQvI2VjP=7_mp;kXyCSel$xZVn&kHx zq2p_+O6bTM@V~`&WQ{~VMF0A^s`UOJ)Bjz3|HCG-1|c6M9wnI{$C8Lpz;f|hy%>V5gRh6)D{;)%c{9GWj+>!zfjRlRL&xi*C m5fB6!L%0M?xlN3Xc#(g2Ou2aZ_&E7E1wc?EV?Hh($Ugw)vo(JJ literal 0 HcmV?d00001 diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question1.py b/VIT-7 Week-1 Python-Homework-Team-3/Question1.py new file mode 100644 index 0000000..e6d45c1 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question1.py @@ -0,0 +1,5 @@ +# Write a python code that prints numbers from 1 to 10 on the screen. + +for i in range(1, 11): #for i in means we loop through those numbers one by one. + #range(1, 11) generates numbers starting from 1 up to, but not including, 11 + print(i) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question10.py b/VIT-7 Week-1 Python-Homework-Team-3/Question10.py new file mode 100644 index 0000000..2b4342f --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question10.py @@ -0,0 +1,17 @@ +#Write the code that calculates the person's weight index and returns the result as underweight, overweight or overweight according to the index value. (You can look on the internet for the weight index calculation) To do this, ask the user for their weight and height measurements. weight index If it is below 25, it is weak, Between 25-30 is normal, If you are over 30-40, you are overweight. If you are over 40, you are overweight +weight = float(input("Enter your weight in kilograms: ")) #float(input(...)) function is used to allow decimal inputs for weight and height +height = float(input("Enter your height in meters; ")) + +bmi = weight /(height ** 2) + +if bmi < 18.5: + category = "Underweight" +elif 18.5 <= bmi <25: + category = "Normal weight" +elif 25 <= bmi <30: + category = "Overweight" +else: + category = "Obesity" + +print(f"Your BMI is: {bmi:.2f}") #:.2f formatting in the print statement rounds the BMI to two decimal places for readability. +print(f"You are classified as: {category}") diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question11.py b/VIT-7 Week-1 Python-Homework-Team-3/Question11.py new file mode 100644 index 0000000..c6282b8 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question11.py @@ -0,0 +1,16 @@ +#How to write a Python program that finds the largest of three numbers entered by a user? +num1 = float(input("Enter the first number: ")) #Use float() so it works with both integers and decimal numbers +num2 = float(input("Enter the second number: ")) +num3 = float(input("Enter the third number: ")) + +if num1 >= num2 and num1 >= num3: + largest = num1 +elif num2 >= num1 and num2 >= num3: + largest = num2 +else: + largest = num3 + +print("The largest number is: ", largest) + + +#largest = max(num1, num2, num3) Python also has a built-in function called max() \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question12.py b/VIT-7 Week-1 Python-Homework-Team-3/Question12.py new file mode 100644 index 0000000..b92f5c9 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question12.py @@ -0,0 +1,15 @@ +#Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. +#If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. This printing process is 4 lessons. and the lessons will be written one after the other. +for course in range(1,5): # Repeat the process for 4 courses + print("Course", course) + + midterm = float(input("Enter the midterm grade: ")) + final = float(input("Enter the final grade: ")) + + average = (midterm * 0.4) + (final * 0.6) #Calculate the average + + if average >= 50: + print("Result: Succesful") + else: + print("Result: Failed") + \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question2.py b/VIT-7 Week-1 Python-Homework-Team-3/Question2.py new file mode 100644 index 0000000..30fe530 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question2.py @@ -0,0 +1,17 @@ +#Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. + +# Ask the user for a number +num = int(input("Enter a number: ")) + +for i in range(1, num + 1): #loops from 1 up to the number inclusive. + if i % 2 == 0: # checks if the number is divisible by 2 + print(i) + + +num = int(input("Enter a number: ")) + +i = 1 # starts counting from 1 +while i <= num: + if i % 2 == 0: # checks if it's even + print(i) + i += 1 # increases the counter each time \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question3.py b/VIT-7 Week-1 Python-Homework-Team-3/Question3.py new file mode 100644 index 0000000..26b6cce --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question3.py @@ -0,0 +1,6 @@ +#Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. +start = int(input("Enter the start value: ")) +end = int(input("Enter the end value: ")) # int(..) converts the input (a string) to a number + +for i in range(start, end + 1): # range() stops before the end number, so +1 includes the last number + print(i) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question4.py b/VIT-7 Week-1 Python-Homework-Team-3/Question4.py new file mode 100644 index 0000000..1366b16 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question4.py @@ -0,0 +1,6 @@ +#Get a number from the user and write a Python code that prints whether this number is odd or even. +num = int(input("Enter a number: ")) +if num % 2 == 0: #Check if the number is even + print("The number is even.") +else: + print("The number is odd.") diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question5.py b/VIT-7 Week-1 Python-Homework-Team-3/Question5.py new file mode 100644 index 0000000..2da4b7e --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question5.py @@ -0,0 +1,7 @@ +#Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. +#For example: if the user entered 5, the program should give the following output: Enter a number from the user: 5 Factorial: 120 +num = int(input("Enter a number: ")) #int(..) converts the input to an integer +factorial = 1 #start with 1 because multiplying by 0 would make everything 0 +for i in range(1, num + 1): #Use a for loop to calculate factorial + factorial *= i #each loop multiplies the current factorial by i + print("Factorial:", factorial) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question6.py b/VIT-7 Week-1 Python-Homework-Team-3/Question6.py new file mode 100644 index 0000000..330a5e6 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question6.py @@ -0,0 +1,16 @@ +#Write a Python code that receives a number from the user and checks whether this number is prime. +#A prime number is a number greater than 1 that is only divisible by 1 and itself. +num = int (input("Enter a number: ")) +is_prime = True #assume it is prime until we find a reason to say otherwise +if num <= 1: + is_prime = False #1 and any number below it is not prime +else: + for i in range(2, int(num ** 0.5) + 1): #for i in range(2, num): check all the numbers between 2 and (num - 1) to see if any of them divide your number evenly + #num ** 0.5 = square root of the number + if num % i == 0: + is_prime = False + break +if is_prime: + print(num, "is a prime number.") +else: + print(num, "is not a prime number.") diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question7.py b/VIT-7 Week-1 Python-Homework-Team-3/Question7.py new file mode 100644 index 0000000..874605e --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question7.py @@ -0,0 +1,9 @@ +#How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? +limit = int(input("Enter a limit: ")) +fib_list = [0, 1] #start with the first two Fibonacci numbers +while True: #we use a while loop so we can keep generating numbers until we decide to stop. + next_number = fib_list[-1] + fib_list[-2] #this adds the last two numbers in the list to get the next one. + if next_number > limit: + break #stop the loop if next number is over the limit + fib_list.append(next_number) #add it to the list +print("Fibbonacci sequence up to", limit, ":", fib_list) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question8.py b/VIT-7 Week-1 Python-Homework-Team-3/Question8.py new file mode 100644 index 0000000..16bf199 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question8.py @@ -0,0 +1,4 @@ +#Write a Python code that takes a word from the user and prints the reverse of this word on the screen. +word = input("Enter a word: ") +reversed_word = word[::-1] #reverse the word using slicing, word[::-1] gives you the word in reverse +print("Reversed word:", reversed_word) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question9.py b/VIT-7 Week-1 Python-Homework-Team-3/Question9.py new file mode 100644 index 0000000..2df6c6d --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/Question9.py @@ -0,0 +1,8 @@ +#How to create a combination of loop and conditional statement that takes a word input from the user and checks whether that word is a palindrome (the same when read backwards)? +#A palindrome is a word (or phrase) that reads the same forwards and backwards. For example, the word "level" is a palindrome, but "hello" is not. +word = input("Enter a word: ") +reversed_word = word[::-1] +if word == reversed_word: + print(f"{word} is a palindrome!") #f-string, the part inside {} will be evaluated and inserted into the string +else: + print(f"{word} is not a palindrome.") \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/README.md b/VIT-7 Week-1 Python-Homework-Team-3/README.md new file mode 100644 index 0000000..c9af1b4 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/README.md @@ -0,0 +1,30 @@ +Python_Modul_Week_1 +Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. + +Question 2: Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. + +Question 3: Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. + +Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even. + +Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. For example: if the user entered 5, the program should give the following output: Enter a number from the user: 5 Factorial: 120 + +Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. + +Question 7: How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? + +Question 8: Write a Python code that takes a word from the user and prints the reverse of this word on the screen. + +Question 9: How to create a combination of loop and conditional statement that takes a word input from the user and checks whether that word is a palindrome (the same when read backwards)? + +Question 10: Write the code that calculates the person's weight index and returns the result as underweight, overweight or overweight according to the index value. (You can look on the internet for the weight index calculation) To do this, ask the user for their weight and height measurements. weight index If it is below 25, it is weak, Between 25-30 is normal, If you are over 30-40, you are overweight. If you are over 40, you are overweight. + +Question 11: How to write a Python program that finds the largest of three numbers entered by a user? + +Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. This printing process is 4 lessons. and the lessons will be written one after the other. + +Hackerrank assignments +https://www.hackerrank.com/challenges/python-arithmetic-operators/problem +https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem +https://www.hackerrank.com/challenges/python-print/problem +https://www.hackerrank.com/challenges/finding-the-percentage/problem From 7c6a4515337d73e79a2afbf2072b5e71276d6051 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 18:32:02 +0200 Subject: [PATCH 16/20] Delete Python_Modul_Week1-Sumeyra_team3_w1.zip --- Python_Modul_Week1-Sumeyra_team3_w1.zip | Bin 7592 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Python_Modul_Week1-Sumeyra_team3_w1.zip diff --git a/Python_Modul_Week1-Sumeyra_team3_w1.zip b/Python_Modul_Week1-Sumeyra_team3_w1.zip deleted file mode 100644 index cfc776119ce1d6d0be188c6d786c378062f8fb0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7592 zcmbW5bzGF&*2ifPVJHDbN~9D97`mlXqz4d`7zP-cVE{o;B&8dr8v$vhyBj1Wq?PWF zmOJOhQRcn({T$9SpJ!(NTHn3)+H0@1eyU2CSa@iEJe~9rPyYGm-(L)9*U?m65azZv z2FkW3j#dWRP^cvcsNrZ0b%7fhAfQIp+y>4d4lPY=H1suI40F|go5KC4DgMo;U&WB7 zB#|%IUo^#T216Jj5OA2WBLeF1r(q4S9UHJyTV4UEpvLSwPEle~t&{e(W{M~IIjc%JsPNJGMR`Ra9@RaO= zDKwu*eT@AusY#_k`u5UKCAbl253B#x3^a!bQlu5;7172dr;ZgZ4_jtg+r2{-@=##6_MNC9XY-(p|i7C!QHck2uZhbLjqC&24 zQ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5!z<_qZ6j@B8mxFlaUuntXxMMFpI?lPK*2vAbUY zB8$E1FU|sgvS;*Zv1B}x3C!Q?UeKTEo73LM9Jx^34V)+=8+5OhW6gi0=20Ae@w8_A zhVPHu#hlF^RY<~q3wiYP!m2kGJasq4o0(OiF^c}MO)<5tX!$J_!6cC?F`O_fD1k;2 zzXwpY2hh50pY<(l$c5Z7-40MfH7^b~EcO`BZuh@l*@dOm5CD2!&!ZR{6A1BqZ?$OG z?kiW3+-xOp1Q=TD1Oyh=E1St##%aGR42=oF(_63^s7r1Z9)fR$y_EKbt}xdm;&HY~ zvImp9us6=pqC18V52O)--?NfGRm~6ts3}-{`fARRVQTS1PfI)`CUp53@LWY0bZ+PA z`AjCixOE4)Y!PD05+?fV1M}t|&yFJez78wp$cQj8hsSgj4fuR}I!Ieu-5#g88@(K| zdQv25@($nl1umnbge)!vNK@iN%o1sUcS_ieqHsO!kp6<-H?>dEb5AI8|P7RX$c}lGFX1FT_Gx71VM zGBB0fG6rwWcE82Ai)xpr+hT`pP1Q_6CYHe?sQvI2VjP=7_mp;kXyCSel$xZVn&kHx zq2p_+O6bTM@V~`&WQ{~VMF0A^s`UOJ)Bjz3|HCG-1|c6M9wnI{$C8Lpz;f|hy%>V5gRh6)D{;)%c{9GWj+>!zfjRlRL&xi*C m5fB6!L%0M?xlN3Xc#(g2Ou2aZ_&E7E1wc?EV?Hh($Ugw)vo(JJ From 1695c673afe0957cb55a3ab40972f625781492e7 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 18:48:30 +0200 Subject: [PATCH 17/20] Revert "Delete Python_Modul_Week1-Sumeyra_team3_w1.zip" This reverts commit 7c6a4515337d73e79a2afbf2072b5e71276d6051. --- Python_Modul_Week1-Sumeyra_team3_w1.zip | Bin 0 -> 7592 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Python_Modul_Week1-Sumeyra_team3_w1.zip diff --git a/Python_Modul_Week1-Sumeyra_team3_w1.zip b/Python_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Hx zq2p_+O6bTM@V~`&WQ{~VMF0A^s`UOJ)Bjz3|HCG-1|c6M9wnI{$C8Lpz;f|hy%>V5gRh6)D{;)%c{9GWj+>!zfjRlRL&xi*C m5fB6!L%0M?xlN3Xc#(g2Ou2aZ_&E7E1wc?EV?Hh($Ugw)vo(JJ literal 0 HcmV?d00001 From 13fcf77c722d419e64ecf1ad8afcf38e9fb73607 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 18:51:12 +0200 Subject: [PATCH 18/20] Revert "Python Week-1 Team-3 Homework" This reverts commit 834155b9f9a484e99ed05ff7a8fcd24b13a92476. --- Mithat/HackerRank1 | 6 ++++ Mithat/HackerRank2 | 9 ++++++ Mithat/HackerRank3 | 5 +++ Mithat/HackerRank4 | 9 ++++++ Mithat/Question1 | 3 ++ Mithat/Question10 | 11 +++++++ Mithat/Question11 | 11 +++++++ Mithat/Question12 | 15 +++++++++ Mithat/Question2 | 16 ++++++++++ Mithat/Question3 | 12 +++++++ Mithat/Question4 | 7 ++++ Mithat/Question5 | 14 ++++++++ Mithat/Question6 | 17 ++++++++++ Mithat/Question7 | 11 +++++++ Mithat/Question8 | 3 ++ Mithat/Question9 | 7 ++++ Python_Modul_Week1-Sumeyra_team3_w1.zip | Bin 7592 -> 0 bytes .../Question1.py | 5 --- .../Question10.py | 17 ---------- .../Question11.py | 16 ---------- .../Question12.py | 15 --------- .../Question2.py | 17 ---------- .../Question3.py | 6 ---- .../Question4.py | 6 ---- .../Question5.py | 7 ---- .../Question6.py | 16 ---------- .../Question7.py | 9 ------ .../Question8.py | 4 --- .../Question9.py | 8 ----- VIT-7 Week-1 Python-Homework-Team-3/README.md | 30 ------------------ 30 files changed, 156 insertions(+), 156 deletions(-) create mode 100644 Mithat/HackerRank1 create mode 100644 Mithat/HackerRank2 create mode 100644 Mithat/HackerRank3 create mode 100644 Mithat/HackerRank4 create mode 100644 Mithat/Question1 create mode 100644 Mithat/Question10 create mode 100644 Mithat/Question11 create mode 100644 Mithat/Question12 create mode 100644 Mithat/Question2 create mode 100644 Mithat/Question3 create mode 100644 Mithat/Question4 create mode 100644 Mithat/Question5 create mode 100644 Mithat/Question6 create mode 100644 Mithat/Question7 create mode 100644 Mithat/Question8 create mode 100644 Mithat/Question9 delete mode 100644 Python_Modul_Week1-Sumeyra_team3_w1.zip delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question1.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question10.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question11.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question12.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question2.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question3.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question4.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question5.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question6.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question7.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question8.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/Question9.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/README.md diff --git a/Mithat/HackerRank1 b/Mithat/HackerRank1 new file mode 100644 index 0000000..daf4adc --- /dev/null +++ b/Mithat/HackerRank1 @@ -0,0 +1,6 @@ +if __name__ == '__main__': + a = int(input()) + b = int(input()) + print(a+b) + print(a-b) + print(a*b) \ No newline at end of file diff --git a/Mithat/HackerRank2 b/Mithat/HackerRank2 new file mode 100644 index 0000000..9a5528d --- /dev/null +++ b/Mithat/HackerRank2 @@ -0,0 +1,9 @@ +arr=[2,3,6,6,5] +arr.sort() +arr.reverse() +for num in arr: + if num < arr[0]: + print(num) + break + + \ No newline at end of file diff --git a/Mithat/HackerRank3 b/Mithat/HackerRank3 new file mode 100644 index 0000000..de3a275 --- /dev/null +++ b/Mithat/HackerRank3 @@ -0,0 +1,5 @@ +n = int(input()) +string="" +for i in range(1,n+1): + string=string+str(i) +print(string) \ No newline at end of file diff --git a/Mithat/HackerRank4 b/Mithat/HackerRank4 new file mode 100644 index 0000000..b65830c --- /dev/null +++ b/Mithat/HackerRank4 @@ -0,0 +1,9 @@ +n = int(input()) +student_marks = {} +for _ in range(n): + name, *line = input().split() + scores = list(map(float, line)) + student_marks[name] = scores +query_name = input() +Average=sum(student_marks[query_name])/3 +print(f"{Average:.2f}") \ No newline at end of file diff --git a/Mithat/Question1 b/Mithat/Question1 new file mode 100644 index 0000000..06f7638 --- /dev/null +++ b/Mithat/Question1 @@ -0,0 +1,3 @@ +# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. +for i in range(1,11): + print(i) \ No newline at end of file diff --git a/Mithat/Question10 b/Mithat/Question10 new file mode 100644 index 0000000..2c427d1 --- /dev/null +++ b/Mithat/Question10 @@ -0,0 +1,11 @@ + +mass=float(input("enter your kilogram ")) +height=float(input('enter your height in cm ')) +weightIndex=mass/(height/100)**2 +if weightIndex<25: + print('you are weak') +elif weightIndex<=25<=30: + print('you are normal') +elif weightIndex<=30<=40: + print('you are overweight') +else : print('you are obese') diff --git a/Mithat/Question11 b/Mithat/Question11 new file mode 100644 index 0000000..4118a24 --- /dev/null +++ b/Mithat/Question11 @@ -0,0 +1,11 @@ +# Question 11: How to write a Python program that finds the largest of three numbers entered by a user? +n1=int(input("enter first number ")) +n2=int(input("enter second number ")) +n3=int(input("enter third number ")) +b=n1 +if n1>=n2 and n1>=n3 : + print("biggest number is ", n1) +elif n2>=n1 and n2>=n3 : + print("biggest number is ", n2) +elif n3>=n1 and n3>=n2 : + print("biggest number is ", n3) \ No newline at end of file diff --git a/Mithat/Question12 b/Mithat/Question12 new file mode 100644 index 0000000..3510f93 --- /dev/null +++ b/Mithat/Question12 @@ -0,0 +1,15 @@ +# Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. +# If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. +# This printing process is 4 lessons. and the lessons will be written one after the other. +print("Enter info for 4 lessons:\n") +for i in range(1,5): + print("Lesson", i) + lesson = input("Enter lesson name: ") + midterm = float(input("Enter midterm grade: ")) + final = float(input("Enter final grade: ")) + average = midterm * 0.4 + final * 0.6 + if average >= 50: + print(lesson + ": SUCCESSFUL (Average: " + str(average) + ")\n") + else: + print(lesson + ": FAILED (Average: " + str(average) + ")\n") + i = i+ 1 diff --git a/Mithat/Question2 b/Mithat/Question2 new file mode 100644 index 0000000..5fb340a --- /dev/null +++ b/Mithat/Question2 @@ -0,0 +1,16 @@ +#Question 2: Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. +n=input("enter a number ") +while not n.isdigit(): + n=input("Please enter a valid number ") +evenNumbers="" +for i in range(0,int(n)+1): + if i%2==0: + evenNumbers = evenNumbers +" "+ str(i) +print("with 'for loop' solution\n",evenNumbers) +evenNumbers="" +j=0 +while j<= int(n): + if j%2==0: + evenNumbers = evenNumbers +" "+ str(j) + j=j+1 +print("with 'while loop' solution\n",evenNumbers) \ No newline at end of file diff --git a/Mithat/Question3 b/Mithat/Question3 new file mode 100644 index 0000000..465b2e5 --- /dev/null +++ b/Mithat/Question3 @@ -0,0 +1,12 @@ +#- Question 3: Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. + +n1=input("enter an integer number as a start ") +while not n1.isdigit(): + n1=input("Please enter an integer number as a start ") +n2=input("enter an integer number as an end number ") +while not n2.isdigit() or int(n2)<=int(n1): + n2=input("Please enter an integer number as a end number ") +numbers="" +for i in range(int(n1),int(n2)+1): + numbers=numbers+" "+str(i) +print("Numbers between",n1, "and",n2,numbers) \ No newline at end of file diff --git a/Mithat/Question4 b/Mithat/Question4 new file mode 100644 index 0000000..993b48f --- /dev/null +++ b/Mithat/Question4 @@ -0,0 +1,7 @@ +#Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even +n=input("enter a number ") +while not n.isdigit(): + n=input("Please enter a valid number ") +if int(n)%2==0: + print("Entered number",n,"is an even number") +else: print("Entered number",n,"is an odd number") \ No newline at end of file diff --git a/Mithat/Question5 b/Mithat/Question5 new file mode 100644 index 0000000..60cd648 --- /dev/null +++ b/Mithat/Question5 @@ -0,0 +1,14 @@ +#Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. +#For example: if the user entered 5, the program should give the following output: +#Enter a number from the user: 5 +#Factorial: 120 + +n=input("enter a positive number ") +while not n.isdigit() or int(n)<1: + n=input("Please enter a valid positive number ") +factorial=1 +i=1 +while i <=int(n): + factorial=factorial*i + i=i+1 +print("factorial: ", factorial) \ No newline at end of file diff --git a/Mithat/Question6 b/Mithat/Question6 new file mode 100644 index 0000000..826aeb6 --- /dev/null +++ b/Mithat/Question6 @@ -0,0 +1,17 @@ + +#Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. + +n=input("Enter a valid integer number ") + +if int(n)==1: print("entered number is not a prime number") + +else: + if 2<=int(n): + j=0 + for i in range(1,int(n)+1): + if int(n)% int(i) ==0: + j=j+1 + + if j==2 : print("entered number is a prime number") + else: print("entered number is NOT a prime number") + \ No newline at end of file diff --git a/Mithat/Question7 b/Mithat/Question7 new file mode 100644 index 0000000..7c32311 --- /dev/null +++ b/Mithat/Question7 @@ -0,0 +1,11 @@ +#Question 7: How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? +n1=int(input("Enter first number for Fibonacci Sequance ") ) +n2=int(input("Enter second number for Fibonacci Sequance ") ) +limit=int(input("Enter limit number for Fibonacci Sequance ") ) +list=[n1,n2] +while (int(n1)+int(n2))4d4lPY=H1suI40F|go5KC4DgMo;U&WB7 zB#|%IUo^#T216Jj5OA2WBLeF1r(q4S9UHJyTV4UEpvLSwPEle~t&{e(W{M~IIjc%JsPNJGMR`Ra9@RaO= zDKwu*eT@AusY#_k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#+Yy)Ym18}JD}kbOPy}=^G$VUJbeQ&_9&l%-Ou0qtZ2~a0$X>H zP7kb_v}DcMriuauPX?bYVv&(MM5!z<_qZ6j@B8mxFlaUuntXxMMFpI?lPK*2vAbUY zB8$E1FU|sgvS;*Zv1B}x3C!Q?UeKTEo73LM9Jx^34V)+=8+5OhW6gi0=20Ae@w8_A zhVPHu#hlF^RY<~q3wiYP!m2kGJasq4o0(OiF^c}MO)<5tX!$J_!6cC?F`O_fD1k;2 zzXwpY2hh50pY<(l$c5Z7-40MfH7^b~EcO`BZuh@l*@dOm5CD2!&!ZR{6A1BqZ?$OG z?kiW3+-xOp1Q=TD1Oyh=E1St##%aGR42=oF(_63^s7r1Z9)fR$y_EKbt}xdm;&HY~ zvImp9us6=pqC18V52O)--?NfGRm~6ts3}-{`fARRVQTS1PfI)`CUp53@LWY0bZ+PA z`AjCixOE4)Y!PD05+?fV1M}t|&yFJez78wp$cQj8hsSgj4fuR}I!Ieu-5#g88@(K| zdQv25@($nl1umnbge)!vNK@iN%o1sUcS_ieqHsO!kp6<-H?>dEb5AI8|P7RX$c}lGFX1FT_Gx71VM zGBB0fG6rwWcE82Ai)xpr+hT`pP1Q_6CYHe?sQvI2VjP=7_mp;kXyCSel$xZVn&kHx zq2p_+O6bTM@V~`&WQ{~VMF0A^s`UOJ)Bjz3|HCG-1|c6M9wnI{$C8Lpz;f|hy%>V5gRh6)D{;)%c{9GWj+>!zfjRlRL&xi*C m5fB6!L%0M?xlN3Xc#(g2Ou2aZ_&E7E1wc?EV?Hh($Ugw)vo(JJ diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question1.py b/VIT-7 Week-1 Python-Homework-Team-3/Question1.py deleted file mode 100644 index e6d45c1..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question1.py +++ /dev/null @@ -1,5 +0,0 @@ -# Write a python code that prints numbers from 1 to 10 on the screen. - -for i in range(1, 11): #for i in means we loop through those numbers one by one. - #range(1, 11) generates numbers starting from 1 up to, but not including, 11 - print(i) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question10.py b/VIT-7 Week-1 Python-Homework-Team-3/Question10.py deleted file mode 100644 index 2b4342f..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question10.py +++ /dev/null @@ -1,17 +0,0 @@ -#Write the code that calculates the person's weight index and returns the result as underweight, overweight or overweight according to the index value. (You can look on the internet for the weight index calculation) To do this, ask the user for their weight and height measurements. weight index If it is below 25, it is weak, Between 25-30 is normal, If you are over 30-40, you are overweight. If you are over 40, you are overweight -weight = float(input("Enter your weight in kilograms: ")) #float(input(...)) function is used to allow decimal inputs for weight and height -height = float(input("Enter your height in meters; ")) - -bmi = weight /(height ** 2) - -if bmi < 18.5: - category = "Underweight" -elif 18.5 <= bmi <25: - category = "Normal weight" -elif 25 <= bmi <30: - category = "Overweight" -else: - category = "Obesity" - -print(f"Your BMI is: {bmi:.2f}") #:.2f formatting in the print statement rounds the BMI to two decimal places for readability. -print(f"You are classified as: {category}") diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question11.py b/VIT-7 Week-1 Python-Homework-Team-3/Question11.py deleted file mode 100644 index c6282b8..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question11.py +++ /dev/null @@ -1,16 +0,0 @@ -#How to write a Python program that finds the largest of three numbers entered by a user? -num1 = float(input("Enter the first number: ")) #Use float() so it works with both integers and decimal numbers -num2 = float(input("Enter the second number: ")) -num3 = float(input("Enter the third number: ")) - -if num1 >= num2 and num1 >= num3: - largest = num1 -elif num2 >= num1 and num2 >= num3: - largest = num2 -else: - largest = num3 - -print("The largest number is: ", largest) - - -#largest = max(num1, num2, num3) Python also has a built-in function called max() \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question12.py b/VIT-7 Week-1 Python-Homework-Team-3/Question12.py deleted file mode 100644 index b92f5c9..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question12.py +++ /dev/null @@ -1,15 +0,0 @@ -#Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. -#If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. This printing process is 4 lessons. and the lessons will be written one after the other. -for course in range(1,5): # Repeat the process for 4 courses - print("Course", course) - - midterm = float(input("Enter the midterm grade: ")) - final = float(input("Enter the final grade: ")) - - average = (midterm * 0.4) + (final * 0.6) #Calculate the average - - if average >= 50: - print("Result: Succesful") - else: - print("Result: Failed") - \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question2.py b/VIT-7 Week-1 Python-Homework-Team-3/Question2.py deleted file mode 100644 index 30fe530..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question2.py +++ /dev/null @@ -1,17 +0,0 @@ -#Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. - -# Ask the user for a number -num = int(input("Enter a number: ")) - -for i in range(1, num + 1): #loops from 1 up to the number inclusive. - if i % 2 == 0: # checks if the number is divisible by 2 - print(i) - - -num = int(input("Enter a number: ")) - -i = 1 # starts counting from 1 -while i <= num: - if i % 2 == 0: # checks if it's even - print(i) - i += 1 # increases the counter each time \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question3.py b/VIT-7 Week-1 Python-Homework-Team-3/Question3.py deleted file mode 100644 index 26b6cce..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question3.py +++ /dev/null @@ -1,6 +0,0 @@ -#Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. -start = int(input("Enter the start value: ")) -end = int(input("Enter the end value: ")) # int(..) converts the input (a string) to a number - -for i in range(start, end + 1): # range() stops before the end number, so +1 includes the last number - print(i) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question4.py b/VIT-7 Week-1 Python-Homework-Team-3/Question4.py deleted file mode 100644 index 1366b16..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question4.py +++ /dev/null @@ -1,6 +0,0 @@ -#Get a number from the user and write a Python code that prints whether this number is odd or even. -num = int(input("Enter a number: ")) -if num % 2 == 0: #Check if the number is even - print("The number is even.") -else: - print("The number is odd.") diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question5.py b/VIT-7 Week-1 Python-Homework-Team-3/Question5.py deleted file mode 100644 index 2da4b7e..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question5.py +++ /dev/null @@ -1,7 +0,0 @@ -#Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. -#For example: if the user entered 5, the program should give the following output: Enter a number from the user: 5 Factorial: 120 -num = int(input("Enter a number: ")) #int(..) converts the input to an integer -factorial = 1 #start with 1 because multiplying by 0 would make everything 0 -for i in range(1, num + 1): #Use a for loop to calculate factorial - factorial *= i #each loop multiplies the current factorial by i - print("Factorial:", factorial) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question6.py b/VIT-7 Week-1 Python-Homework-Team-3/Question6.py deleted file mode 100644 index 330a5e6..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question6.py +++ /dev/null @@ -1,16 +0,0 @@ -#Write a Python code that receives a number from the user and checks whether this number is prime. -#A prime number is a number greater than 1 that is only divisible by 1 and itself. -num = int (input("Enter a number: ")) -is_prime = True #assume it is prime until we find a reason to say otherwise -if num <= 1: - is_prime = False #1 and any number below it is not prime -else: - for i in range(2, int(num ** 0.5) + 1): #for i in range(2, num): check all the numbers between 2 and (num - 1) to see if any of them divide your number evenly - #num ** 0.5 = square root of the number - if num % i == 0: - is_prime = False - break -if is_prime: - print(num, "is a prime number.") -else: - print(num, "is not a prime number.") diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question7.py b/VIT-7 Week-1 Python-Homework-Team-3/Question7.py deleted file mode 100644 index 874605e..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question7.py +++ /dev/null @@ -1,9 +0,0 @@ -#How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? -limit = int(input("Enter a limit: ")) -fib_list = [0, 1] #start with the first two Fibonacci numbers -while True: #we use a while loop so we can keep generating numbers until we decide to stop. - next_number = fib_list[-1] + fib_list[-2] #this adds the last two numbers in the list to get the next one. - if next_number > limit: - break #stop the loop if next number is over the limit - fib_list.append(next_number) #add it to the list -print("Fibbonacci sequence up to", limit, ":", fib_list) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question8.py b/VIT-7 Week-1 Python-Homework-Team-3/Question8.py deleted file mode 100644 index 16bf199..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question8.py +++ /dev/null @@ -1,4 +0,0 @@ -#Write a Python code that takes a word from the user and prints the reverse of this word on the screen. -word = input("Enter a word: ") -reversed_word = word[::-1] #reverse the word using slicing, word[::-1] gives you the word in reverse -print("Reversed word:", reversed_word) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/Question9.py b/VIT-7 Week-1 Python-Homework-Team-3/Question9.py deleted file mode 100644 index 2df6c6d..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/Question9.py +++ /dev/null @@ -1,8 +0,0 @@ -#How to create a combination of loop and conditional statement that takes a word input from the user and checks whether that word is a palindrome (the same when read backwards)? -#A palindrome is a word (or phrase) that reads the same forwards and backwards. For example, the word "level" is a palindrome, but "hello" is not. -word = input("Enter a word: ") -reversed_word = word[::-1] -if word == reversed_word: - print(f"{word} is a palindrome!") #f-string, the part inside {} will be evaluated and inserted into the string -else: - print(f"{word} is not a palindrome.") \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/README.md b/VIT-7 Week-1 Python-Homework-Team-3/README.md deleted file mode 100644 index c9af1b4..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/README.md +++ /dev/null @@ -1,30 +0,0 @@ -Python_Modul_Week_1 -Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. - -Question 2: Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. - -Question 3: Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. - -Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even. - -Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. For example: if the user entered 5, the program should give the following output: Enter a number from the user: 5 Factorial: 120 - -Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. - -Question 7: How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? - -Question 8: Write a Python code that takes a word from the user and prints the reverse of this word on the screen. - -Question 9: How to create a combination of loop and conditional statement that takes a word input from the user and checks whether that word is a palindrome (the same when read backwards)? - -Question 10: Write the code that calculates the person's weight index and returns the result as underweight, overweight or overweight according to the index value. (You can look on the internet for the weight index calculation) To do this, ask the user for their weight and height measurements. weight index If it is below 25, it is weak, Between 25-30 is normal, If you are over 30-40, you are overweight. If you are over 40, you are overweight. - -Question 11: How to write a Python program that finds the largest of three numbers entered by a user? - -Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. This printing process is 4 lessons. and the lessons will be written one after the other. - -Hackerrank assignments -https://www.hackerrank.com/challenges/python-arithmetic-operators/problem -https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem -https://www.hackerrank.com/challenges/python-print/problem -https://www.hackerrank.com/challenges/finding-the-percentage/problem From ac1021a194a96eb8640c7ab25ce443dcc0e8270b Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 18:57:43 +0200 Subject: [PATCH 19/20] VIT-7 Week-1 Python-Homework-Team-3\HackerRank --- VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 | 6 ++++++ VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 | 9 +++++++++ VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 | 5 +++++ VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 | 9 +++++++++ 4 files changed, 29 insertions(+) create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 create mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 new file mode 100644 index 0000000..daf4adc --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 @@ -0,0 +1,6 @@ +if __name__ == '__main__': + a = int(input()) + b = int(input()) + print(a+b) + print(a-b) + print(a*b) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 new file mode 100644 index 0000000..9a5528d --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 @@ -0,0 +1,9 @@ +arr=[2,3,6,6,5] +arr.sort() +arr.reverse() +for num in arr: + if num < arr[0]: + print(num) + break + + \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 new file mode 100644 index 0000000..de3a275 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 @@ -0,0 +1,5 @@ +n = int(input()) +string="" +for i in range(1,n+1): + string=string+str(i) +print(string) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 new file mode 100644 index 0000000..3d103d4 --- /dev/null +++ b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 @@ -0,0 +1,9 @@ +k = int(input()) +student_marks = {} +for _ in range(k): + name, *line = input().split() + scores = list(map(float, line)) + student_marks[name] = scores +query_name = input() +Average=sum(student_marks[query_name])/k +print(f"{Average:.2f}") \ No newline at end of file From 0e29f45406253808fcd551e0d6ca64b3eca36466 Mon Sep 17 00:00:00 2001 From: mithat720 Date: Fri, 18 Apr 2025 19:25:41 +0200 Subject: [PATCH 20/20] Homework is completed. Homework is completed. --- Mithat/HackerRank1 => HackerRank1 | 0 Mithat/HackerRank2 => HackerRank2 | 0 Mithat/HackerRank3 => HackerRank3 | 0 Mithat/HackerRank4 => HackerRank4 | 4 ++-- Mithat/Question1 | 3 --- Mithat/Question10 | 11 ----------- Mithat/Question11 | 11 ----------- Mithat/Question12 | 15 --------------- Mithat/Question2 | 16 ---------------- Mithat/Question3 | 12 ------------ Mithat/Question4 | 7 ------- Mithat/Question5 | 14 -------------- Mithat/Question6 | 17 ----------------- Mithat/Question7 | 11 ----------- Mithat/Question8 | 3 --- Mithat/Question9 | 7 ------- Question1.py | 5 +++++ Question10.py | 17 +++++++++++++++++ Question11.py | 16 ++++++++++++++++ Question12.py | 15 +++++++++++++++ Question2.py | 17 +++++++++++++++++ Question3.py | 6 ++++++ Question4.py | 6 ++++++ Question5.py | 7 +++++++ Question6.py | 16 ++++++++++++++++ Question7.py | 9 +++++++++ Question8.py | 4 ++++ Question9.py | 8 ++++++++ VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 | 6 ------ VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 | 9 --------- VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 | 5 ----- VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 | 9 --------- 32 files changed, 128 insertions(+), 158 deletions(-) rename Mithat/HackerRank1 => HackerRank1 (100%) rename Mithat/HackerRank2 => HackerRank2 (100%) rename Mithat/HackerRank3 => HackerRank3 (100%) rename Mithat/HackerRank4 => HackerRank4 (85%) delete mode 100644 Mithat/Question1 delete mode 100644 Mithat/Question10 delete mode 100644 Mithat/Question11 delete mode 100644 Mithat/Question12 delete mode 100644 Mithat/Question2 delete mode 100644 Mithat/Question3 delete mode 100644 Mithat/Question4 delete mode 100644 Mithat/Question5 delete mode 100644 Mithat/Question6 delete mode 100644 Mithat/Question7 delete mode 100644 Mithat/Question8 delete mode 100644 Mithat/Question9 create mode 100644 Question1.py create mode 100644 Question10.py create mode 100644 Question11.py create mode 100644 Question12.py create mode 100644 Question2.py create mode 100644 Question3.py create mode 100644 Question4.py create mode 100644 Question5.py create mode 100644 Question6.py create mode 100644 Question7.py create mode 100644 Question8.py create mode 100644 Question9.py delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 delete mode 100644 VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 diff --git a/Mithat/HackerRank1 b/HackerRank1 similarity index 100% rename from Mithat/HackerRank1 rename to HackerRank1 diff --git a/Mithat/HackerRank2 b/HackerRank2 similarity index 100% rename from Mithat/HackerRank2 rename to HackerRank2 diff --git a/Mithat/HackerRank3 b/HackerRank3 similarity index 100% rename from Mithat/HackerRank3 rename to HackerRank3 diff --git a/Mithat/HackerRank4 b/HackerRank4 similarity index 85% rename from Mithat/HackerRank4 rename to HackerRank4 index b65830c..dcd6929 100644 --- a/Mithat/HackerRank4 +++ b/HackerRank4 @@ -1,6 +1,6 @@ -n = int(input()) +k = int(input()) student_marks = {} -for _ in range(n): +for _ in range(k): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores diff --git a/Mithat/Question1 b/Mithat/Question1 deleted file mode 100644 index 06f7638..0000000 --- a/Mithat/Question1 +++ /dev/null @@ -1,3 +0,0 @@ -# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen. -for i in range(1,11): - print(i) \ No newline at end of file diff --git a/Mithat/Question10 b/Mithat/Question10 deleted file mode 100644 index 2c427d1..0000000 --- a/Mithat/Question10 +++ /dev/null @@ -1,11 +0,0 @@ - -mass=float(input("enter your kilogram ")) -height=float(input('enter your height in cm ')) -weightIndex=mass/(height/100)**2 -if weightIndex<25: - print('you are weak') -elif weightIndex<=25<=30: - print('you are normal') -elif weightIndex<=30<=40: - print('you are overweight') -else : print('you are obese') diff --git a/Mithat/Question11 b/Mithat/Question11 deleted file mode 100644 index 4118a24..0000000 --- a/Mithat/Question11 +++ /dev/null @@ -1,11 +0,0 @@ -# Question 11: How to write a Python program that finds the largest of three numbers entered by a user? -n1=int(input("enter first number ")) -n2=int(input("enter second number ")) -n3=int(input("enter third number ")) -b=n1 -if n1>=n2 and n1>=n3 : - print("biggest number is ", n1) -elif n2>=n1 and n2>=n3 : - print("biggest number is ", n2) -elif n3>=n1 and n3>=n2 : - print("biggest number is ", n3) \ No newline at end of file diff --git a/Mithat/Question12 b/Mithat/Question12 deleted file mode 100644 index 3510f93..0000000 --- a/Mithat/Question12 +++ /dev/null @@ -1,15 +0,0 @@ -# Question 12: Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. -# If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. -# This printing process is 4 lessons. and the lessons will be written one after the other. -print("Enter info for 4 lessons:\n") -for i in range(1,5): - print("Lesson", i) - lesson = input("Enter lesson name: ") - midterm = float(input("Enter midterm grade: ")) - final = float(input("Enter final grade: ")) - average = midterm * 0.4 + final * 0.6 - if average >= 50: - print(lesson + ": SUCCESSFUL (Average: " + str(average) + ")\n") - else: - print(lesson + ": FAILED (Average: " + str(average) + ")\n") - i = i+ 1 diff --git a/Mithat/Question2 b/Mithat/Question2 deleted file mode 100644 index 5fb340a..0000000 --- a/Mithat/Question2 +++ /dev/null @@ -1,16 +0,0 @@ -#Question 2: Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. -n=input("enter a number ") -while not n.isdigit(): - n=input("Please enter a valid number ") -evenNumbers="" -for i in range(0,int(n)+1): - if i%2==0: - evenNumbers = evenNumbers +" "+ str(i) -print("with 'for loop' solution\n",evenNumbers) -evenNumbers="" -j=0 -while j<= int(n): - if j%2==0: - evenNumbers = evenNumbers +" "+ str(j) - j=j+1 -print("with 'while loop' solution\n",evenNumbers) \ No newline at end of file diff --git a/Mithat/Question3 b/Mithat/Question3 deleted file mode 100644 index 465b2e5..0000000 --- a/Mithat/Question3 +++ /dev/null @@ -1,12 +0,0 @@ -#- Question 3: Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. - -n1=input("enter an integer number as a start ") -while not n1.isdigit(): - n1=input("Please enter an integer number as a start ") -n2=input("enter an integer number as an end number ") -while not n2.isdigit() or int(n2)<=int(n1): - n2=input("Please enter an integer number as a end number ") -numbers="" -for i in range(int(n1),int(n2)+1): - numbers=numbers+" "+str(i) -print("Numbers between",n1, "and",n2,numbers) \ No newline at end of file diff --git a/Mithat/Question4 b/Mithat/Question4 deleted file mode 100644 index 993b48f..0000000 --- a/Mithat/Question4 +++ /dev/null @@ -1,7 +0,0 @@ -#Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even -n=input("enter a number ") -while not n.isdigit(): - n=input("Please enter a valid number ") -if int(n)%2==0: - print("Entered number",n,"is an even number") -else: print("Entered number",n,"is an odd number") \ No newline at end of file diff --git a/Mithat/Question5 b/Mithat/Question5 deleted file mode 100644 index 60cd648..0000000 --- a/Mithat/Question5 +++ /dev/null @@ -1,14 +0,0 @@ -#Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. -#For example: if the user entered 5, the program should give the following output: -#Enter a number from the user: 5 -#Factorial: 120 - -n=input("enter a positive number ") -while not n.isdigit() or int(n)<1: - n=input("Please enter a valid positive number ") -factorial=1 -i=1 -while i <=int(n): - factorial=factorial*i - i=i+1 -print("factorial: ", factorial) \ No newline at end of file diff --git a/Mithat/Question6 b/Mithat/Question6 deleted file mode 100644 index 826aeb6..0000000 --- a/Mithat/Question6 +++ /dev/null @@ -1,17 +0,0 @@ - -#Question 6: Write a Python code that receives a number from the user and checks whether this number is prime. - -n=input("Enter a valid integer number ") - -if int(n)==1: print("entered number is not a prime number") - -else: - if 2<=int(n): - j=0 - for i in range(1,int(n)+1): - if int(n)% int(i) ==0: - j=j+1 - - if j==2 : print("entered number is a prime number") - else: print("entered number is NOT a prime number") - \ No newline at end of file diff --git a/Mithat/Question7 b/Mithat/Question7 deleted file mode 100644 index 7c32311..0000000 --- a/Mithat/Question7 +++ /dev/null @@ -1,11 +0,0 @@ -#Question 7: How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? -n1=int(input("Enter first number for Fibonacci Sequance ") ) -n2=int(input("Enter second number for Fibonacci Sequance ") ) -limit=int(input("Enter limit number for Fibonacci Sequance ") ) -list=[n1,n2] -while (int(n1)+int(n2))= num2 and num1 >= num3: + largest = num1 +elif num2 >= num1 and num2 >= num3: + largest = num2 +else: + largest = num3 + +print("The largest number is: ", largest) + + +#largest = max(num1, num2, num3) Python also has a built-in function called max() \ No newline at end of file diff --git a/Question12.py b/Question12.py new file mode 100644 index 0000000..b92f5c9 --- /dev/null +++ b/Question12.py @@ -0,0 +1,15 @@ +#Get Midterm and Final grades from a student for any course. The sum of 40% of the midterm exam grade and 60% of the final grade will give the year-end average. +#If the average is below 50, "FAILED" will appear on the screen, and if it is 50 or above, "SUCCESSFUL" will be displayed on the screen. This printing process is 4 lessons. and the lessons will be written one after the other. +for course in range(1,5): # Repeat the process for 4 courses + print("Course", course) + + midterm = float(input("Enter the midterm grade: ")) + final = float(input("Enter the final grade: ")) + + average = (midterm * 0.4) + (final * 0.6) #Calculate the average + + if average >= 50: + print("Result: Succesful") + else: + print("Result: Failed") + \ No newline at end of file diff --git a/Question2.py b/Question2.py new file mode 100644 index 0000000..30fe530 --- /dev/null +++ b/Question2.py @@ -0,0 +1,17 @@ +#Take a number input from the user and write a Python program that prints even numbers up to this number on the screen. Do this first with 'for' and then with 'while' loops. + +# Ask the user for a number +num = int(input("Enter a number: ")) + +for i in range(1, num + 1): #loops from 1 up to the number inclusive. + if i % 2 == 0: # checks if the number is divisible by 2 + print(i) + + +num = int(input("Enter a number: ")) + +i = 1 # starts counting from 1 +while i <= num: + if i % 2 == 0: # checks if it's even + print(i) + i += 1 # increases the counter each time \ No newline at end of file diff --git a/Question3.py b/Question3.py new file mode 100644 index 0000000..26b6cce --- /dev/null +++ b/Question3.py @@ -0,0 +1,6 @@ +#Write a Python code that receives a start and end value from the user and prints all the numbers between these values ​​(including the end value) on the screen. +start = int(input("Enter the start value: ")) +end = int(input("Enter the end value: ")) # int(..) converts the input (a string) to a number + +for i in range(start, end + 1): # range() stops before the end number, so +1 includes the last number + print(i) \ No newline at end of file diff --git a/Question4.py b/Question4.py new file mode 100644 index 0000000..1366b16 --- /dev/null +++ b/Question4.py @@ -0,0 +1,6 @@ +#Get a number from the user and write a Python code that prints whether this number is odd or even. +num = int(input("Enter a number: ")) +if num % 2 == 0: #Check if the number is even + print("The number is even.") +else: + print("The number is odd.") diff --git a/Question5.py b/Question5.py new file mode 100644 index 0000000..2da4b7e --- /dev/null +++ b/Question5.py @@ -0,0 +1,7 @@ +#Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1. +#For example: if the user entered 5, the program should give the following output: Enter a number from the user: 5 Factorial: 120 +num = int(input("Enter a number: ")) #int(..) converts the input to an integer +factorial = 1 #start with 1 because multiplying by 0 would make everything 0 +for i in range(1, num + 1): #Use a for loop to calculate factorial + factorial *= i #each loop multiplies the current factorial by i + print("Factorial:", factorial) \ No newline at end of file diff --git a/Question6.py b/Question6.py new file mode 100644 index 0000000..330a5e6 --- /dev/null +++ b/Question6.py @@ -0,0 +1,16 @@ +#Write a Python code that receives a number from the user and checks whether this number is prime. +#A prime number is a number greater than 1 that is only divisible by 1 and itself. +num = int (input("Enter a number: ")) +is_prime = True #assume it is prime until we find a reason to say otherwise +if num <= 1: + is_prime = False #1 and any number below it is not prime +else: + for i in range(2, int(num ** 0.5) + 1): #for i in range(2, num): check all the numbers between 2 and (num - 1) to see if any of them divide your number evenly + #num ** 0.5 = square root of the number + if num % i == 0: + is_prime = False + break +if is_prime: + print(num, "is a prime number.") +else: + print(num, "is not a prime number.") diff --git a/Question7.py b/Question7.py new file mode 100644 index 0000000..874605e --- /dev/null +++ b/Question7.py @@ -0,0 +1,9 @@ +#How to create a loop that calculates the Fibonacci sequence and returns the result as a list containing numbers up to a certain limit? +limit = int(input("Enter a limit: ")) +fib_list = [0, 1] #start with the first two Fibonacci numbers +while True: #we use a while loop so we can keep generating numbers until we decide to stop. + next_number = fib_list[-1] + fib_list[-2] #this adds the last two numbers in the list to get the next one. + if next_number > limit: + break #stop the loop if next number is over the limit + fib_list.append(next_number) #add it to the list +print("Fibbonacci sequence up to", limit, ":", fib_list) \ No newline at end of file diff --git a/Question8.py b/Question8.py new file mode 100644 index 0000000..16bf199 --- /dev/null +++ b/Question8.py @@ -0,0 +1,4 @@ +#Write a Python code that takes a word from the user and prints the reverse of this word on the screen. +word = input("Enter a word: ") +reversed_word = word[::-1] #reverse the word using slicing, word[::-1] gives you the word in reverse +print("Reversed word:", reversed_word) \ No newline at end of file diff --git a/Question9.py b/Question9.py new file mode 100644 index 0000000..2df6c6d --- /dev/null +++ b/Question9.py @@ -0,0 +1,8 @@ +#How to create a combination of loop and conditional statement that takes a word input from the user and checks whether that word is a palindrome (the same when read backwards)? +#A palindrome is a word (or phrase) that reads the same forwards and backwards. For example, the word "level" is a palindrome, but "hello" is not. +word = input("Enter a word: ") +reversed_word = word[::-1] +if word == reversed_word: + print(f"{word} is a palindrome!") #f-string, the part inside {} will be evaluated and inserted into the string +else: + print(f"{word} is not a palindrome.") \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 deleted file mode 100644 index daf4adc..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank1 +++ /dev/null @@ -1,6 +0,0 @@ -if __name__ == '__main__': - a = int(input()) - b = int(input()) - print(a+b) - print(a-b) - print(a*b) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 deleted file mode 100644 index 9a5528d..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank2 +++ /dev/null @@ -1,9 +0,0 @@ -arr=[2,3,6,6,5] -arr.sort() -arr.reverse() -for num in arr: - if num < arr[0]: - print(num) - break - - \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 deleted file mode 100644 index de3a275..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank3 +++ /dev/null @@ -1,5 +0,0 @@ -n = int(input()) -string="" -for i in range(1,n+1): - string=string+str(i) -print(string) \ No newline at end of file diff --git a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 b/VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 deleted file mode 100644 index 3d103d4..0000000 --- a/VIT-7 Week-1 Python-Homework-Team-3/HackerRank4 +++ /dev/null @@ -1,9 +0,0 @@ -k = int(input()) -student_marks = {} -for _ in range(k): - name, *line = input().split() - scores = list(map(float, line)) - student_marks[name] = scores -query_name = input() -Average=sum(student_marks[query_name])/k -print(f"{Average:.2f}") \ No newline at end of file