# TD5 - Parcours de séquences (sur papier)
## 1.1 Le code suivant donne:
```py
3
5
```
## 1.2
L'instruction `tot+i` est executée 3 fois, et `12`
## 1.3
Elle est executée 2 fois, `[1,0,0,4,8,0]`
## 1.4
Il retournes: `i: 3, liste[3]: 2`
# Exercice 2
## 2.1
```py
def premier_el(m, valeur):
for i in range(n):
if m[i] == valeur:
return i
return -1
```
## 2.2
```py
def premier_el(m, valeur):
count = 0
for i in range(n):
if m[i] == 6:
count += 1
return count
```
## 2.3
```py
def max_liste(m):
return max(m)
def max_liste(m):
cmax = m[0]
for i in m:
cmax = max(cmax, i)
return cmax
```
# Exercice 3
- 3.1: Même chose que l'exercice `2.1`
- 3.2:
```py
def palinfind(mot):
for i in range(len(mot)):
if i != mot/2 and mot[i] != mot[-i]:
return False
return True
```
# Pour s'entrainer
## 1.1
```py
3
2
```
## 1.2
```py
def last(m, el):
idx = -1
for i in range(len(m)):
if m[i] == el:
idx = i
return idx
```
## 1.3
```py
def counter(l):
c = []
for i in range(10):
c[i] = l.count(i)
return c
```