TypeError: 'NoneType' object is not subscriptable
hedia
-
yg_be Messages postés 24281 Statut Contributeur -
yg_be Messages postés 24281 Statut Contributeur -
def saisir():
while True:
n=input("donner une chaine numérique de 15 chiffres")
if len(n)==15 and n.isnumeric():
break
def doubler(x:int):
return x*2
def somme(n):
s=0
for i in range(15):
if i%2==0:
s=s+doubler(int(n[i]))
s=s+int(n[i])
return s
def affiche(n):
if somme(n)%10==0:
print('oui IMEI')
else:
print('non IMEI')
#programme principal
n=saisir()
affiche(n)
A voir également:
- 'Nonetype' object is not subscriptable
- Typeerror: can't multiply sequence by non-int of type 'str' - Forum Python
- TypeError: 'int' object is not iterable ✓ - Forum Python
- TypeError: 'float' object is not subscriptable - Forum Python
- Uncaught TypeError: document.getElementsById is not a functi ✓ - Forum Javascript
- TypeError : 'builtin function or method' et '_getitem__' ✓ - Forum Python