Feb-14-2020, 04:59 AM
Hello everyone!
I've been working on this program:
My txt file looks like this:
2
true false
true true
The output says:Traceback (most recent call last):
File "C:/Users/admin/Desktop/Prog compétition/Prob3file.py", line 10, in <module>
prob[i] = int(prob[i])
IndexError: list index out of range
I don't understand why it's not working :/
Thankyou!
I've been working on this program:
txt = "Prob03.in.txt"
msg = open(txt, "r")
msg = msg.read()
n=int
countCase=1
for prob in msg:
prob =prob.split()
i =0
while i<2:
prob[i] = int(prob[i])
i=+1
if prob[0] != prob[1]:
print("false")
elif prob[0] == prob[1]:
print("true") My txt file looks like this:
2
true false
true true
The output says:Traceback (most recent call last):
File "C:/Users/admin/Desktop/Prog compétition/Prob3file.py", line 10, in <module>
prob[i] = int(prob[i])
IndexError: list index out of range
I don't understand why it's not working :/
Thankyou!
