diff --git a/1.1.py b/1.1.py new file mode 100644 index 0000000..089dc57 --- /dev/null +++ b/1.1.py @@ -0,0 +1,4 @@ +sayi= input('tam sayi giriniz') +def int_return(): + return sayi +print(int_return()) \ No newline at end of file diff --git a/1.2.py b/1.2.py new file mode 100644 index 0000000..b6fd202 --- /dev/null +++ b/1.2.py @@ -0,0 +1,4 @@ +def add(sayi=int(input('tam sayi giriniz'))): + sayi = sayi+2 + return sayi +print(add()) \ No newline at end of file diff --git a/1.3.py b/1.3.py new file mode 100644 index 0000000..6480a57 --- /dev/null +++ b/1.3.py @@ -0,0 +1,4 @@ + +def greet(name=input('isim giriniz'),msg='Good morning'): + print('Hello', name + ' ' + msg) +greet() \ No newline at end of file diff --git a/1.4.py b/1.4.py new file mode 100644 index 0000000..29ac8dc --- /dev/null +++ b/1.4.py @@ -0,0 +1,6 @@ +liste=int(input('sayi giriniz')) +def toplam(*liste): + sum=0 + for n in liste: + sum=sum+n +print(toplam(liste)) \ No newline at end of file diff --git a/1.5.py b/1.5.py new file mode 100644 index 0000000..01f8b32 --- /dev/null +++ b/1.5.py @@ -0,0 +1,8 @@ +num=int(input('sayilari girin')) +liste=num.split(' ') +def adder(liste): + if len(liste)>=5: + return ('Besten uzun') + elif len(liste)<5: + return('Besten az') +adder(liste) \ No newline at end of file diff --git a/1.6.py b/1.6.py new file mode 100644 index 0000000..5626fa1 --- /dev/null +++ b/1.6.py @@ -0,0 +1,12 @@ +def divide(a = int(input("deger giriniz: "))): + result = int(a/2) + return result + +print('sonuc', divide()) + +def divided_with_sum(b=int(input('deger verin'))): + result2=divided(b)+6 + return result2 + +print('sonuc',divided_with_sum()) + diff --git a/2.py b/2.py new file mode 100644 index 0000000..0794ac5 --- /dev/null +++ b/2.py @@ -0,0 +1,12 @@ +def computepay(hour,rate): + if hour > 40: + payment = 1.5 * rate * (hour - 40) + (40 *rate) + else: + payment = hour * rate + return payment + +hours = float(input("Enter Hours:")) +rates = float(input("Enter rate per hour:")) + + +print('Aldiginiz para miktari', computepay(hours,rates) ) \ No newline at end of file diff --git a/3.1.py b/3.1.py new file mode 100644 index 0000000..33e2b58 --- /dev/null +++ b/3.1.py @@ -0,0 +1,5 @@ +def hacim_hesapla(r=int(input('yaricap giriniz'))): + pi=3.14 + hesap=((4 / 3) * pi * (r ** 3)) + return hesap +print(hacim_hesapla()) \ No newline at end of file diff --git a/3.2.py b/3.2.py new file mode 100644 index 0000000..8625b7e --- /dev/null +++ b/3.2.py @@ -0,0 +1,5 @@ +def main(): + r= 3 + cal=((4 / 3) * 3 * (r ** 3)) + return cal +print("volume: ", main()) \ No newline at end of file diff --git a/3.3.py b/3.3.py new file mode 100644 index 0000000..43cbc5b --- /dev/null +++ b/3.3.py @@ -0,0 +1,18 @@ +def sphere(): + + + def sphere_area(r=int(input('Alan icin yaricap giriniz: '))): + pi=3.14 + hesap1=(pi * (r ** 2)) + return hesap1 + def sphere_volume(r=int(input('Hacim icin yaricap giriniz: '))): + pi=3.14 + hesap2=((4 / 3) * pi * (r ** 3)) + return hesap2 + + print('alan: ', sphere_area()) + print('hacim: ', sphere_volume()) + +print(sphere()) + + diff --git a/3.4.py b/3.4.py new file mode 100644 index 0000000..e8ac6b4 --- /dev/null +++ b/3.4.py @@ -0,0 +1,21 @@ +"""def sum_of_numbers(a,b): + result=0 + if a<=b: + result=a+ sum_of_numbers(a+1,b) + return result +print(sum_of_numbers(1,4))""" + +"""def input_function(a=int(input("Please entere a number")),b=int(input("Please enter a number "))): + if a=b: + return sum_of_numbers(b,a) +print(input_function())""" + +myList=[2,4,5,78,8] +def sum_of_numbers(x): + result=0 + for i in x: + result+=i + return result +print(sum_of_numbers(myList)) \ No newline at end of file