Jul-19-2018, 12:13 PM
(This post was last modified: Jul-19-2018, 12:17 PM by PierreSoulier.)
Hello here is my code:
Just to mention, if I add chiffres = list(chiffres) between line 2 and 3 I still get the error
n=int(x[4]) chiffres = [] while n > 0: chiffres.append(n % 10) n = n // 10 chiffres = tuple(reversed(chiffres)) pc = [] for i in range (0,2): pc.append(chiffres[i]) test = ''.join(str(e) for e in pc) print(test)And i get this error
Traceback (most recent call last): File "main.py", line 614, in <module> chiffres.append(n % 10) AttributeError: 'tuple' object has no attribute 'append'[] is not to declare a list? I'm confused
Just to mention, if I add chiffres = list(chiffres) between line 2 and 3 I still get the error