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
60 changes: 60 additions & 0 deletions nesli_week_1/hackerrank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 1- https://www.hackerrank.com/challenges/python-arithmetic-operators/problem

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
n = int(input())
arr = list(map(int, input().split()))
arr = list(set(arr))
arr.sort()
print(arr[-2])

# 3- https://www.hackerrank.com/challenges/python-print/problem

n = int(input().strip())
for i in range(1, n + 1):
print(i, end='')

# 4- https://www.hackerrank.com/challenges/finding-the-percentage/problem
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()
scores = student_marks[query_name]
average = sum(scores) / len(scores)
print(f"{average:.2f}") #virgulden sonra ii basamak icin

#n sayisi kadar for dongusu calisir
#ilk girdileri name yaparken digerleri line oldu.

#Girdileri hackerrank otomatik aliyor.
#ilk olarak kac ogrenci oldugunu n alir
#sozluk olusturur

#her ogrencinin ismini bir anahtar(key), notlarinin ise bir liste olarak student_marks sozlugune ekler
#sorgu calistirir:kullanicidan sorgulamak istedigi ogrencinin adini alir ve o ogrencinin notlarini bulur
#Notlarin ortalamasini hesaplar ve yazdirir :

#1ogrencileri ve notlari toplami:
#student_marks[name] = scores
#bu islem for dongusu icinde olur ve her ogrencinin adi(name)ile notlari(scores) sozluge eklenir

#2 kullanicinin sorgulanmasi:
#query_name = input()
#scores =students_marks[query_name]

#kullanicidan bir isim alinir ve bu ismi kullanarak solukten ilgili notlara ulasiriz
#numbers = ["1,"2","3","4"]

#map fonksiyonu kullanilir
#result = map(int, numbers)
#print(result)
#print(list(result))
72 changes: 72 additions & 0 deletions nesli_week_1/homework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#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.

#Kullanıcıdan bir sayı girdisi alın ve bu sayıya kadar olan çift sayıları ekrana yazdıran bir Python programı yazın.
# Bunu önce 'for' sonra 'while' döngüleriyle yapın.


"""
n = int(input("bir sayi girin: "))
for i in range(0, n+1):
if i%2 == 0:
print(i)
"""

""""

n = int(input("bir sayi giriniz: "))
i = 0
while i <= n:
if i %2 == 0:
print(i)
i = i+1

"""

# Question 6:
# Write a Python code that receives a number from the user and checks whether this number is prime.
## Kullanıcıdan bir sayı alan ve bu sayının asal olup olmadığını kontrol eden bir Python kodu yazın.
"""
sayi = int(input("Bir sayi girin: "))

if sayi < 2:
print(f"{sayi} bir asal sayi degildir.")
else:
for i in range(2, sayi):
if sayi % i == 0:
print(f"{sayi} asal sayi degildir")
break
else:
print(f"{sayi} bir asal sayidir. ")

"""


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



"""" #Soru 10: Kişinin kilo endeksini hesaplayan ve sonucu düşük kilolu olarak döndüren kodu yazın,
Endeks değerine göre aşırı kilolu veya fazla kilolu. (Ağırlık endeksi hesaplaması için internete bakabilirsiniz)
Bunu yapmak için kullanıcıdan kilo ve boy ölçümlerini isteyin. kilo endeksi 25'in altındaysa zayıf, 25-30 arası normal,
30-40'ın üzerindeyse kilolusunuz. 40'ın üzerindeyseniz fazla kilolusunuz.
"""
boy = float(input("boyunuzu giriniz: "))
kilo = float(input("kilonuzu girniz: "))
vucut_kitle_indeksi = float(kilo / boy ** 2)
print("vucut kitle indeksiniz: ", vucut_kitle_indeksi)

if (vucut_kitle_indeksi <= 30):
if (vucut_kitle_indeksi < 25):
print("zayifsiniz")
else:
print("normal kilodasiniz.")
elif (vucut_kitle_indeksi >= 40):
print ("asiri kilolusunuz")
else:
print ("kilolusunuz")