100.
with open("n.txt", "w") as f:
f.write("3\nx\n5\n")
total = 0
with open("n.txt") as f:
for row in f:
try:
total += int(row)
except ValueError:
total += 100
print(total, f.closed)
What does the program print?Log in to join the discussion.
Loading…