Skip to content

Commit cd3e9e4

Browse files
committed
Python Kodları
1 parent 8f058ab commit cd3e9e4

39 files changed

+22748
-0
lines changed

Asal Sayı.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sayac=0
2+
sayi=input('Sayı: ')
3+
for i in range(2,int(sayi)):
4+
if(int(sayi)%i==0):
5+
sayac+=1
6+
break
7+
if(sayac!=0):
8+
print("Sayı Asal Değil")
9+
else:
10+
print("Sayı Asal")

Asal Sayılar.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# coding=utf-8
2+
3+
"""
4+
Girdiğimiz bir sayıya kadar ki asal olan bütün sayıları listeleme
5+
"""
6+
7+
deger = int(input("Kaça kadar ki asal sayıları arıyorsunuz? : "))
8+
asal = []
9+
10+
for i in range(2, deger):
11+
flag = False
12+
for j in range(2, i):
13+
if i % j == 0:
14+
flag = True
15+
break
16+
if not flag:
17+
asal.append(i)
18+
19+
for i in asal:
20+
print(i)
21+
22+
print("\n0 - {} arasında toplam {} tane asal sayı vardır.".format(deger, len(asal)))

Binary.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
decimal = int(input("Number in decimal format: "))
2+
3+
def binary(n):
4+
output = ""
5+
while n > 0:
6+
output = "{}{}".format(n % 2, output)
7+
n = n // 2
8+
return output
9+
10+
# our method
11+
print(binary(decimal))
12+

Celcius-Fahrenheit.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
print("-" * 30)
2+
print("1- Celsius to fahrenheit")
3+
print("2- Fahrenheit to celsius")
4+
print("-" * 30)
5+
6+
choice = input("Your choice (1/2): ")
7+
8+
if choice == "1":
9+
print("\n# Celsius to Fahrenheit")
10+
celsius = float(input("Degree to convert: "))
11+
fahrenheit = (celsius * 1.8) + 32
12+
print("{} degree celsius is equal to {} degree fahrenheit.".format(celsius, fahrenheit))
13+
elif choice == "2":
14+
print("\n# Fahrenheit to Celsius")
15+
fahrenheit = float(raw_input("Degree to convert: "))
16+
celsius = (fahrenheit - 32) / 1.8
17+
print("{} degree fahrenheit is equal to {} degree celsius.".format(fahrenheit, celsius))
18+
else:
19+
print("Congratulations! You hacked the super-program.")

DB Browser (SQLite).lnk

1.38 KB
Binary file not shown.

Database Yazdırma.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import sqlite3
2+
3+
vt=sqlite3.connect("database")
4+
im=vt.cursor()
5+
6+
7+
satırlar=im.execute("select ID,ADI,SOYADI,OKULNO FROM OGRENCI")
8+
for i in (satırlar):
9+
print(i)
10+
11+
12+
13+
14+
15+
vt.commit()
16+
vt.close()

Facebook.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import webbrowser as sp
2+
sp.open("www.facebook.com")

Fibonacci.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def fibonacci(n, output=[]):
2+
a=1
3+
b=1
4+
for i in range(n):
5+
a, b = b, a + b
6+
output.append(str(a))
7+
return output
8+
9+
number = int(input("Length of fibonacci sequence: "))
10+
11+
print("Result: 1,{}".format(",".join(fibonacci(number))))

Haber.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/python3
2+
# -*- coding: utf-8 -*-
3+
4+
import feedparser
5+
6+
"""
7+
cnn'den son dakika haberlerini çekme
8+
"""
9+
url = "http://www.cnnturk.com/feed/rss/news"
10+
haberler = feedparser.parse(url)
11+
12+
i = 0
13+
for haber in haberler.entries:
14+
i += 1
15+
print(i)
16+
print(haber.title)
17+
print(haber.link)
18+
print(haber.summary)
19+
print("\n")

Hava Durumu.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# coding=utf-8
2+
import re
3+
import urllib.request
4+
5+
url = "https://www.havadurumu15gunluk.net/havadurumu/istanbul-hava-durumu-15-gunluk.html"
6+
site = urllib.request.urlopen(url).read().decode('utf-8')
7+
8+
r_gunduz = '<td width="45">&nbsp;&nbsp;(-?\d+)°C</td>'
9+
r_gece = '<td width="45">&nbsp;(-?\d+)°C</td>'
10+
r_gun = '<td width="70" nowrap="nowrap">(.*)</td>'
11+
r_tarih = '<td width="75" nowrap="nowrap">(.*)</td>'
12+
r_aciklama = '<img src="/havadurumu/images/trans.gif" alt="İstanbul Hava durumu 15 günlük" width="1" height="1" />(.*)</div>'
13+
14+
comp_gunduz = re.compile(r_gunduz)
15+
comp_gece = re.compile(r_gece)
16+
comp_gun = re.compile(r_gun)
17+
comp_tarih = re.compile(r_tarih)
18+
comp_aciklama = re.compile(r_aciklama)
19+
20+
gunduz = []
21+
gece = []
22+
gun = []
23+
tarih = []
24+
aciklama = []
25+
26+
for i in re.findall(r_gunduz, site):
27+
gunduz.append(i)
28+
29+
for i in re.findall(r_gece, site):
30+
gece.append(i)
31+
32+
for i in re.findall(r_gun, site):
33+
gun.append(i)
34+
35+
for i in re.findall(r_tarih, site):
36+
tarih.append(i)
37+
38+
for i in re.findall(r_aciklama, site):
39+
aciklama.append(i)
40+
41+
print("-" * 75)
42+
print(" ISTANBUL HAVA DURUMU")
43+
print("-" * 75)
44+
for i in range(0, len(gun)):
45+
print("{} {},\n\t\t\t\t\tgündüz: {} °C\tgece: {} °C\t{}".format(tarih[i], gun[i], gunduz[i], gece[i], aciklama[i]))
46+
print("-" * 75)

0 commit comments

Comments
 (0)