0
Surpass the error. Are my codes valid?
mylist=[] mylist.append(100) mylist.append("good") mylist.append(True) print(mylist) mylist[1]=False print(mylist) while mylist != 2: if mylist!=range: try: i= mylist[int(input("index:"))] print(i) except IndexError: continue print(mylist[int(input("index:"))]) else: print("finished") break
1 Respuesta
0
Dunno what you try to do here. The code itself works, though you could change the exception to a general one, then every error is cought. E.g. if you input 5 what do you wish for as outcome?