Answer the question
In order to leave comments, you need to log in
ValueError: invalid literal for int() with base 10: '', what should I do?
Here is part of the code:
with open('28128_A.txt', 'r') as f:
n = int(f.readline())
for i in range(n):
a = int(f.readline())
for i in range(n-1):
b = int(f.readline())
print(a, b)
Answer the question
In order to leave comments, you need to log in
f.readline() reads the next line of the file. Count how many lines you read in your code (hint: more than n)
Read all lines into a list and then compare as you wish
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question