---
# System prepended metadata

title: Untitled

---

class Tranche:
    def __init__(self,t,debut,fin):
        assert isinstance(list)
        assert debut>= 0 and fin <= len(t)
        assert fin>= 0 and fin <= len(t)
        self.t = t
        self.debut = debut
        self.fin = fin
        self.tranche_a=[]

def len(self):
    return self.t - self.debut - self.fin

def getitem(self,i):
        assert i >= 0 and i <= self.len()
        return self.t[self.debut+i]

def setitem(self,i,value):
        assert i >= 0 and i<= self.len()
        self.t[self.debut+i] = value


#2

class Tranche_deux:
    def __init__(self,t,debut,fin):
        assert isinstance(list)
        assert debut>= 0 and fin <= len(t)
        assert fin>= 0 and fin <= len(t)
        self.t = t
        self.debut = debut
        self.fin = fin
        self.tranche_deux=[]

def __len__(self):
    return self.fin-self.debut+1

def __getitem__(self,position):
    return self.tranche_deux[position]

def __setitem__(self,position,valeur):
    self.tranche_deux[position]=valeur

#3
#1ere quesion
print("premiere question")
a=Tranche([1,2,3,4,5),2,4)
print(a.len())
print(a.getitem(1))
a.setitem(1,7)
print(a.getitem(1))

#2eme question
print("-----")
print("deuxième question")
print"-----")
b=Tranche_deux([1,2,3,4,5]),2,4)
print(len(b))
print(b[1])
b[1]=7
print(b[1])

#3eme question
print("-----")
print("troixième quesion")
print("-----")
print(isinstance(b,list)
u=Tranche_deux(b,0,1)
print(len(u))
print(b[0])
print(b[1])
print(isinstance(u,list))





