Python, Reading files, Test what you know | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Python, Reading files, Test what you know

HEY GUYS, IM STUCK ON THIS CHALLENGE. IF SOMEONE CAN SOLVE THIS FOR ME SO I CAN SEE WHERE IM FALLING SHORT. THANKS IN ADVANCE. https://sololearn.com/coach/179/?ref=app MY CURRENT CODE: file = open("/usercode/files/pull_ups.txt") n = int(input()) print(file.readlines(n)) file.close()

30th Aug 2020, 7:41 AM
Matthew Payne
Matthew Payne - avatar
7 Answers
+ 6
file = open("/usercode/files/pull_ups.txt") n = int(input()) list=file.readlines() print(list[n]) file.close()
6th Oct 2020, 6:41 AM
Robert Stehlik
Robert Stehlik - avatar
30th Aug 2020, 8:23 AM
Namit Jain
Namit Jain - avatar
+ 3
print(file.readlines(n)) -----> print(file.readlines()[n])
10th Jul 2021, 11:49 PM
Ryan Meixner
Ryan Meixner - avatar
+ 2
What is the challenge? 🙃 It is not available for non-pros 😢
30th Aug 2020, 7:57 AM
Namit Jain
Namit Jain - avatar
+ 1
im a beginner with this, iv been trying for a while now to solve this 😂 challenge: Tom has done pull ups every day and recorded his results. He recorded each day's results in a new line, so that each line represents each day he has done pull ups. Create a program that takes n number as input and outputs the n-th days result (starting from 0).
30th Aug 2020, 8:00 AM
Matthew Payne
Matthew Payne - avatar
0
thanks
17th Nov 2022, 3:21 PM
Jagani Kuldeep
- 5
what are you trying to do? and no, nobody will just solve it for you.
30th Aug 2020, 7:51 AM
Slick
Slick - avatar