Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions team_1/haluk/hackerrank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Arithmetic Operators

a = int(input())
b = int(input())
print(a+b)
print(a-b)
print(a*b)


# Find Second Maximum Number in a List

n = int(input())
arr = map(int, input().split())
arr= list(set(arr))
arr.remove(max(arr))
print(max(arr))


# Print Function

n = int(input())
rakamlar=[]
for sayi in range(n+1):
rakamlar.append(sayi)
rakamlar.remove(rakamlar[0])
print(''.join(map(str,rakamlar)))


# Finding the Percentage
45 changes: 45 additions & 0 deletions team_1/haluk/homework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 6- Write a Python code that receives a number from the user and checks whether this number is PRIME.

sayi=int(input('\nBir sayi giriniz :'))
def is_prime(sayi):
if sayi <= 1:
return False
for i in range(2, sayi):
if sayi % i == 0:
return False
return True
if is_prime(sayi):
print(sayi,'bir asal sayidir.')
else:
print(sayi,'bir asal sayi degildir.')






# 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?

limit = int(input("\nFibonacci dizisi için bir limit giriniz: "))

fib_list = [0, 1]
while fib_list[-1] + fib_list[-2] <= limit:
fib_list.append(fib_list[-1] + fib_list[-2])
print('\nGirdiginiz sayiya kadar Fibonacci dizisi su sekildedir ;\n',fib_list)




# 11- How to write a Python program that finds the largest of three numbers entered by a user?

sayi1 = int(input("\nBirinci sayiyi giriniz: "))
sayi2 = int(input("Ikinci sayiyi giriniz: "))
sayi3 = int(input("Ucuncu sayiyi giriniz: "))

if sayi1 >= sayi2 and sayi1 >= sayi3:
buyuk = sayi1
elif sayi2 >= sayi1 and sayi2 >= sayi3:
buyuk = sayi2
else:
buyuk = sayi3
print('\nEn buyuk sayi :',buyuk)
45 changes: 45 additions & 0 deletions team_1/islam/hackerranktasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# Task 1
a = int(input())
b = int(input())

print(a+b, a-b, a*b, sep ="\n")

#Task 2
n = int(input())
arr = map(int, input().split())
arr = list(arr)
highest_score = max(arr)
arr = [score for score in arr if score !=highest_score]
runner_up_score=max(arr)

print(runner_up_score)

#Task 3

n = int(input())
string = ""
for i in range(1, n+1):
string +=str(i)

print(string)

#Task 4

def student_average (student_marks, query_name):
for key, value in student_marks.items():
if key == query_name:
average_score = sum(value)/len(value)
print('{:.2f}'.format(average_score))




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()
student_average (student_marks, query_name)
156 changes: 156 additions & 0 deletions team_1/islam/homework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Python_Modul_Week_1

# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen.

# for i in range(1,11):
# print(i)

# 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.
# For Loop Solution
# number = int(input("Please type a number: "))

# for i in range (1, number + 1):
# if i % 2 == 0:
# print(i)

# While Loop Solution
# number = int(input("Please type a number: "))

# i=2

# while i <= number:
# print(i)
# i +=2

# 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.

# start_number = int(input("Please enter a start number: "))
# end_number = int(input("Please enter an end number: "))

# for i in range(start_number, end_number+1):
# print(i)

# Question 4: Get a number from the user and write a Python code that prints whether this number is odd or even.

# number = int(input("Please enter a number to check: "))

# if number % 2 ==0:
# print(f"{number} is an even number." )

# else:
# print(f"{number} is an odd number.")

# 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

# number = int(input("Please eneter a positive integer: "))

# faktorial = 1
# for i in range(1, number+1):
# faktorial*=i

# print(faktorial)


# Question 6: Write a Python code that receives a number from the user and checks whether this number is prime.

# pri_number = int(input("Please enter an integer bigger than 1: "))

# is_prime = True

# for n in range(2, pri_number):
# if pri_number % n == 0:
# print(f"{pri_number} is not prime.")
# is_prime = False
# break

# if is_prime:
# print(f"{pri_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?

# limit = int(input("Please enter a limit number: "))

# fib = [0,1]

# while True:
# next_number = fib[-1]+fib[-2]
# if next_number>limit:
# break
# fib.append(next_number)
# print(f"The fibonacci squence up to {limit} is {fib}")

# Question 8: Write a Python code that takes a word from the user and prints the reverse of this word on the screen.

# word = input("Please write a word to be reversed: ")

# print(word[::-1])

# 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)?

# first_word = input("Please write a word to check if palindrome: ")

# rev_word = first_word[::-1]

# if first_word == rev_word:
# print(f"{first_word} is a polindrome.")
# else:
# print(f"{first_word} is not a polindrome.")

# 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.

# print("Welcome to Weight Index Calculator")
# weight = float(input("Please enter your weight: "))
# height = float(input("Please enter your height: "))

# weight_index = weight/height**height

# if weight_index < 18.5:
# print("You are weak.")

# elif weight_index >= 18.5 and weight_index <= 24.9 :
# print("You are healthy.")

# elif weight_index >= 25 and weight_index < 29.9:
# print("You are overweight.")

# else:
# print("You are obese.")
# Question 11: How to write a Python program that finds the largest of three numbers entered by a user?
# print("Enter 3 numbers to find the largest")
# number_1 = int(input("Please enter the first number: "))
# number_2 = int(input("Please enter the second number: "))
# number_3 = int(input("Please enter the third number: "))

# if number_1 > number_2 and number_1 > number_3:
# print("The first number is the largest.")

# elif number_2 > number_1 and number_2 > number_3:
# print("The second number is the largest.")

# elif number_3 > number_1 and number_3 > number_2:
# print("The third number is the largest.")




# 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("Welcome to Grade Calculator")

# for i in range(4):
# course_name = input(f"Please enter the name of the course {i+1}: ")
# mid_exam = float(input(f"Please enter your {course_name} midterm exam grade: "))
# fin_exam = float(input(f"Please enter your {course_name} final exam grade: "))
# year_average = (mid_exam * 0.4) + (fin_exam * 0.6)

# print(f"{course_name} average:{year_average}")

# if year_average < 50:
# print("FAILED")

# elif year_average >= 50:
# print("SUCCESSFUL")

# print("-" * 30)
102 changes: 102 additions & 0 deletions team_1/yasin/hackerrank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# 1- https://www.hackerrank.com/challenges/python-arithmetic-operators/problem

# Task
# The provided code stub reads two integers from STDIN, and . Add code to print three lines where:

# The first line contains the sum of the two numbers.
# The second line contains the difference of the two numbers (first - second).
# The third line contains the product of the two numbers.
# Example

# Print the following:
# 8
# -2
# 15

a = int(input())
b = int(input())

print(a+b)
print(a-b)
print(a*b)


# 2. https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem

arr = list(map(int, input().split()))
arr = list(set(arr))
arr.sort()
print(arr[-2])

# arr = list(map(int, input().split())) : We split the data received from the user by spaces, convert each element to an integer and convert it to a list.
# arr = list(set(arr)) : We used set() to remove duplicate numbers in the list. Set keeps only unique elements.
# arr.sort() : We sorted the list, with the largest element coming last.
# arr[-2] : We get the second largest number, the element before the end of the list.




# 3- https://www.hackerrank.com/challenges/python-print/problem
list_number =[]
n = int(input("enter a number"))

for i in range(1, n+1):
list_number.append(i)

str_number ="".join(map(str, list_number))
print(str_number)

# input(): Takes an integer n from the user.
# range(): Generates numbers from 1 to n.
# append(): Adds each number to the list (list_number).
# map(): Converts all list elements to strings.
# join(): Combines the string elements into a single string without spaces.

# 4- https://www.hackerrank.com/challenges/finding-the-percentage/problem

n = int(input()) # n sayisi kadar for dongusu calisir.
student_marks = {}
for _ in range(n):
name, *line = input().split() # girdi: "Ali 70 80 90" -> ["Ali", "70", "80", "90"] -> name = "Ali" line = ["70", "80", "90"]
scores = list(map(float, line))
student_marks[name] = scores
query_name = input()
scores = student_marks[query_name]
average = sum(scores) / len(scores)
print(f"{average:.2f}") # 2 ondalık basamak göstermek için


#Girdi Alır:

#İlk olarak kaç öğrenci olduğunu (n) alır.
#Ardından her bir öğrenci için isim ve notları girdi olarak alır.
#Sözlük Oluşturur:

#Her öğrencinin ismini bir anahtar (key), notlarını ise bir liste olarak student_marks sözlüğüne ekler.
#Sorgu Çalıştırır:

#Kullanıcıdan sorgulamak istediği öğrencinin adını alır ve o öğrencinin notlarını bulur.
#Ortalama Hesaplar ve Yazdırır:

#Notların ortalamasını hesaplar ve sonucu yazdırır.


#1- Öğrencileri ve notlarını toplama:
# student_marks[name] = scores
# Bu işlem for döngüsü içinde olur ve her öğrencinin adı (name) ile notları (scores) sözlüğe eklenir.

#2- Kullanıcının sorgulaması:
# query_name = input()
# scores = student_marks[query_name]

# Kullanıcıdan bir isim (örneğin "Ali") alırız ve bu ismi kullanarak sözlükten ilgili notlara ulaşırız.

numbers = ["1", "2", "3", "4"]

# map fonksiyonu kullanılır
result = map(int, numbers)

print(result) # Bu bir map object: <map object at 0x...>

# Listeye çevrildiğinde elemanları görürüz
print(list(result)) # [1, 2, 3, 4]
Loading