0
What am I doing wrong?
file = open("/usercode/files/pull_ups.txt", "r") n = int(input()) b=n-1 print(file.read(b)) file.close() Why i don't have output?
2 Respostas
+ 5
Because file.read() reads a specific number of bytes in the file, not line.
file.read(bytes)
That is why it won't return anything since as far as I know in that challenge, the output is the day no. which are small numbers.
You can use file.readlines() instead to return a list (each line of the file as each element).
Then use the input as your index.
n = int(input())
print(file.readlines()[n])
+ 2
Thanks