This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Stack: | |
| def __init__(self): | |
| self.alist=[] | |
| def pop(self): | |
| return self.alist.pop() | |
| def push(self,a): | |
| self.alist.append(a) | |
| def show(self): | |
| return self.alist | |
| def peek(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Dequeue: | |
| def __init__(self): | |
| self.items=[] | |
| def addRear(self,a): | |
| self.items.insert(0,a) | |
| def addFront(self,a): | |
| self.items.append(a) | |
| def isempty(self): | |
| return self.items==[] | |
| def removeFront(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Stack: | |
| def __init__(self): | |
| self.alist=[] | |
| def pop(self): | |
| return self.alist.pop() | |
| def push(self,a): | |
| self.alist.append(a) | |
| def show(self): | |
| return self.alist | |
| def peek(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #halka sayıcı | |
| #özgür karaçam | |
| class RingBuffer: | |
| def __init__(self,s): | |
| self.size=s | |
| self.items=s*[None] | |
| def append(self,a): | |
| self.items.append(a) | |
| def get(self): | |
| return self.items[-4:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #python 3.5.x | |
| def palind(kelime): | |
| kelime=list(kelime) | |
| if len(kelime)>1: | |
| if kelime.pop(0)!=kelime.pop(): | |
| return False | |
| else: | |
| return palind(kelime) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def ekok(a,b): | |
| okek=1 | |
| bolen=2 | |
| while bolen<=a and bolen <=b: | |
| if(a%bolen==0 and b%bolen==0): | |
| a=a/bolen | |
| b=b/bolen | |
| okek=okek*bolen | |
| else: | |
| if(a%bolen==0): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ks=1 | |
| def karesayisi(a,b): | |
| global ks | |
| karekenar=min(a,b) | |
| alan=a*b | |
| karealan=karekenar**2 | |
| alan=alan-karealan | |
| ks=ks+1 | |
| if alan!=1: | |
| kisakenar=alan/karekenar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pt(a,b): | |
| i=0 | |
| yenidizi=[] | |
| while i<len(a) and i<len(b): | |
| yenidizi.append(a.pop(i)+b.pop(i)) | |
| if len(a)>0: | |
| yenidizi.append(a.pop(i)) | |
| elif len(b)>0: | |
| yenidizi.append(b.pop(i)) | |
| return yenidizi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def polindrom(a): | |
| dizi=list(str(a)) | |
| dizi.reverse() | |
| dizi=str(dizi) | |
| dizi=dizi.replace(",","") | |
| dizi=dizi.replace("[","") | |
| dizi=dizi.replace("]","") | |
| dizi=dizi.replace('"','') | |
| dizi=dizi.replace("'","") | |
| dizi=dizi.replace(" ","") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def binarytodecimal(sayi): | |
| sayi=int(sayi) | |
| ikilik=[] | |
| while sayi>1: | |
| ikilik.append(sayi%2) | |
| sayi=int(sayi/2) | |
| ikilik.append(1) | |
| ikilik.reverse() |