Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a184aa0
Question 1 is done.
mithat720 Apr 8, 2025
c818deb
Question 12 is done
mithat720 Apr 10, 2025
0a8f387
Merge pull request #1 from mithat720/mithat-team-leader
mithat720 Apr 11, 2025
71736c0
HackerRank task 2 is done
mithat720 Apr 11, 2025
26f316a
Merge branch 'main' of https://github.com/mithat720/Python_Modul_Week_1
mithat720 Apr 11, 2025
ad8bfc0
Mithat-PyhtonWeek1Homework
mithat720 Apr 13, 2025
52378af
Delete mithat_team_Phyton _week_1.py
mithat720 Apr 13, 2025
9cca29b
Delete mithat_team_leader_week_1.py
mithat720 Apr 13, 2025
46cff18
Delete Pyhton Module Week 1-task 12
mithat720 Apr 13, 2025
8a4d590
Question 10 changed
mithat720 Apr 13, 2025
6f73aec
Merge branch 'main' of https://github.com/mithat720/Python_Modul_Week_1
mithat720 Apr 13, 2025
0b39dc3
Create icubuk
icubuk Apr 16, 2025
244dbcb
Update Question6
mithat720 Apr 17, 2025
42df39e
Merge branch 'main' of https://github.com/mithat720/Python_Modul_Week_1
mithat720 Apr 17, 2025
4840bc0
Update HackerRank2
mithat720 Apr 17, 2025
c54d35c
Update Question6
mithat720 Apr 17, 2025
0537bd3
Revert "Create icubuk"
mithat720 Apr 18, 2025
33c2a42
Delete icubuk
mithat720 Apr 18, 2025
834155b
Python Week-1 Team-3 Homework
mithat720 Apr 18, 2025
f709c9c
Merge branch 'main' of https://github.com/mithat720/Python_Modul_Week_1
mithat720 Apr 18, 2025
7c6a451
Delete Python_Modul_Week1-Sumeyra_team3_w1.zip
mithat720 Apr 18, 2025
1695c67
Revert "Delete Python_Modul_Week1-Sumeyra_team3_w1.zip"
mithat720 Apr 18, 2025
13fcf77
Revert "Python Week-1 Team-3 Homework"
mithat720 Apr 18, 2025
ac1021a
VIT-7 Week-1 Python-Homework-Team-3\HackerRank
mithat720 Apr 18, 2025
0e29f45
Homework is completed.
mithat720 Apr 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HackerRank1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if __name__ == '__main__':
a = int(input())
b = int(input())
print(a+b)
print(a-b)
print(a*b)
9 changes: 9 additions & 0 deletions HackerRank2
Original file line number Diff line number Diff line change
@@ -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


5 changes: 5 additions & 0 deletions HackerRank3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
n = int(input())
string=""
for i in range(1,n+1):
string=string+str(i)
print(string)
9 changes: 9 additions & 0 deletions HackerRank4
Original file line number Diff line number Diff line change
@@ -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])/3
print(f"{Average:.2f}")
5 changes: 5 additions & 0 deletions Question1.py
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions Question10.py
Original file line number Diff line number Diff line change
@@ -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}")
16 changes: 16 additions & 0 deletions Question11.py
Original file line number Diff line number Diff line change
@@ -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()
15 changes: 15 additions & 0 deletions Question12.py
Original file line number Diff line number Diff line change
@@ -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")

17 changes: 17 additions & 0 deletions Question2.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions Question3.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions Question4.py
Original file line number Diff line number Diff line change
@@ -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.")
7 changes: 7 additions & 0 deletions Question5.py
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions Question6.py
Original file line number Diff line number Diff line change
@@ -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.")
9 changes: 9 additions & 0 deletions Question7.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions Question8.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions Question9.py
Original file line number Diff line number Diff line change
@@ -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.")