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

22nd Apr 2018, 1:51 PM
Chard Astoveza
Chard Astoveza - avatar
1 Antwort
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?
24th Mar 2020, 11:21 AM
loeckchen[INACTIVE]