|
| 1 | +""" |
| 2 | +1- Klavyeden girilen 5 tane sayıyı bir listeye atarak bunların |
| 3 | +karelerinden 20 çıktığında ortaya çıkan sonuca göre sıralayan |
| 4 | +ve listeyi buna göre yazdıran programı yazınız. |
| 5 | +""" |
| 6 | + |
| 7 | +from ast import While |
| 8 | +from cmath import sqrt |
| 9 | +from tokenize import triple_quoted |
| 10 | + |
| 11 | +q = [] |
| 12 | + |
| 13 | +def siralama(n): |
| 14 | + return n*n - 20 |
| 15 | + |
| 16 | +for i in range(0, 5): |
| 17 | + q.append(eval(input())) |
| 18 | + |
| 19 | + |
| 20 | +q.sort(key=siralama) |
| 21 | +print(q) |
| 22 | + |
| 23 | +############################################## |
| 24 | + |
| 25 | +q = 3 |
| 26 | +x = 6 |
| 27 | +a = -5 |
| 28 | + |
| 29 | +if x > a: |
| 30 | + print("x, a'dan büyüktür") |
| 31 | + |
| 32 | +if a < 0: print("a, 0'dan küçüktür") |
| 33 | + |
| 34 | +if a > 0: print("wfhefaeofjşm"); print("fregreg"); w= 12 |
| 35 | + |
| 36 | +############################################## |
| 37 | + |
| 38 | +z = 45 |
| 39 | + |
| 40 | +if z > 34: |
| 41 | + print("z, 34'ten büyüktür") |
| 42 | +elif z == 45: |
| 43 | + print("z 45 e esittir") |
| 44 | +else: |
| 45 | + print("z 45 e eşit değildir.") |
| 46 | + |
| 47 | +"""""""""""""""""""""""""""""""""""""""""""""""""""""" |
| 48 | + |
| 49 | +f = 0 |
| 50 | +v = 6 |
| 51 | +print("f ve v farklı") if f != v else print("f ile v aynı") |
| 52 | + |
| 53 | +e = 5 |
| 54 | +u = 10 |
| 55 | +m = -7 |
| 56 | + |
| 57 | +if a < 10 or u < 10: |
| 58 | + print("a yada u 10 dan küçük") |
| 59 | + |
| 60 | +if a == 10 or u == 10: |
| 61 | + print("a 10 a eşit ve u 10 a eşit") |
| 62 | + |
| 63 | +t = 4 |
| 64 | +if t is 4: |
| 65 | + print("t 4 e eşit") |
| 66 | + |
| 67 | +if t is not 4: |
| 68 | + print("t 4 e eşit değil") |
| 69 | + |
| 70 | +############################################# |
| 71 | + |
| 72 | +s = 7 |
| 73 | +p = 12 |
| 74 | +if s < 8: |
| 75 | + if p > 10: |
| 76 | + print("MERHABA") |
| 77 | + |
| 78 | +"""""""""""""""""""""""""""""""""""""""""" |
| 79 | + |
| 80 | +ö = 4 |
| 81 | + |
| 82 | +if ö > 3: |
| 83 | + pass |
| 84 | +print("nfekfaslkjfla") |
| 85 | + |
| 86 | +ğ = 18 |
| 87 | +while ğ < 25: |
| 88 | + ğ += 1 |
| 89 | + if ğ == 20: |
| 90 | + continue |
| 91 | + if ğ == 25: |
| 92 | + break |
| 93 | + print(ğ) |
| 94 | + |
| 95 | +else: |
| 96 | + print("ğ artık daha büyük") |
| 97 | + |
| 98 | + |
| 99 | +"""""""""""""""""""""""""""""""""""""""""" |
| 100 | + |
| 101 | +for x in range(3,12): |
| 102 | + print(x) |
| 103 | + |
| 104 | +for i in range(0, 10, 3): |
| 105 | + print(i) |
| 106 | + |
| 107 | +for ş in range(20, 8, -3): |
| 108 | + print(ş) |
| 109 | + |
| 110 | +listem = ["adds", True, 3.4, 7, ["freg", "gsrgsfg", "nwynsj"]] |
| 111 | + |
| 112 | +for n in listem: |
| 113 | + print(n) |
| 114 | + |
| 115 | +for ü in listem[4]: |
| 116 | + print(ü) |
| 117 | + |
| 118 | +for p in range(0, 4): |
| 119 | + print(p) |
| 120 | + |
| 121 | +for ç, eleman in enumerate(listem): |
| 122 | + print(ç+1, ". eleman : ", sep="") |
| 123 | + |
| 124 | +########################################################## |
| 125 | + |
| 126 | +def write(): |
| 127 | + print("I am writing.") |
| 128 | + |
| 129 | +write() |
| 130 | + |
| 131 | +def numandmultiply(c,d): |
| 132 | + return c + d, c * d |
| 133 | + |
| 134 | +num, multiply = numandmultiply(4,7) |
| 135 | +print(numandmultiply(4,7)) |
| 136 | +print(num, multiply) |
| 137 | + |
| 138 | +def all_num(*a): |
| 139 | + total = 0 |
| 140 | + for value in a: |
| 141 | + total += a |
| 142 | + return total |
| 143 | + |
| 144 | +print(all_num(3, 5, 7, 78, 2, 1, -345)) |
| 145 | + |
| 146 | + |
| 147 | +def topla(*toplanacak, fazlalık=0): |
| 148 | + total = 0 |
| 149 | + for value in toplanacak: |
| 150 | + total += value + fazlalık |
| 151 | + return total |
| 152 | + |
| 153 | +print(topla(3, 5, 7, 78, 2, 1,fazlalık= -345)) |
| 154 | + |
| 155 | +########################################################### |
| 156 | + |
| 157 | +def br_işlem(**birim): |
| 158 | + print("ad : ", type(birim)) |
| 159 | + print("ad : " + birim["ad"]) |
| 160 | + print("yıl : ", birim["yıl"]) |
| 161 | + print("tipi : ", birim["tip"]) |
| 162 | + |
| 163 | +br_işlem(ad="qew",yıl="2003",tip="asdw") |
| 164 | + |
| 165 | +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
| 166 | + |
| 167 | +lambda_fonk = lambda v : v + 15 |
| 168 | + |
| 169 | +print(lambda_fonk(7)) |
| 170 | + |
| 171 | +toplam= lambda c, d: c+ d |
| 172 | + |
| 173 | +print(toplam(5,98)) |
| 174 | + |
| 175 | +def my_fuction(x): |
| 176 | + return lambda x: x * n |
| 177 | + |
| 178 | + |
| 179 | +katını_al = my_fuction(3) |
| 180 | +print(katını_al(5)) |
| 181 | + |
| 182 | +katını_al = my_fuction(5) |
| 183 | +print(katını_al(5)) |
| 184 | + |
0 commit comments