Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
Here's the working code. Don't need that "for i" loop at all. Just use the input variable (n) as the index into the lines. print(new_list[n])
18th Mar 2021, 12:33 AM
Jerry Hobby
Jerry Hobby - avatar
+ 2
You have: print(newList[i]). Should be: print(new_list[i])
17th Mar 2021, 10:16 PM
Jerry Hobby
Jerry Hobby - avatar
+ 2
Hi..! the following code works, here the thing is we have to use "readline" or "readlines" ##### file = open("/usercode/files/pull_ups.txt") n = int(input()) #your code goes here for i in range(n): file.readline() print(file.readline()) file.close() #######
11th Jun 2021, 12:54 PM
Ghanta Jeevan Babu
Ghanta Jeevan Babu - avatar
+ 1
Jerry Hobby thank you very much your code helped me too. 🌟🌟🌟🌟🌟
13th May 2021, 3:08 PM
Елена Леващева
Елена Леващева - avatar
0
please can you sharare the practice problem to solve ?
3rd Sep 2021, 8:42 PM
hanane el otmani
hanane el otmani - avatar
0
my solution: file = open("/usercode/files/pull_ups.txt") n = int(input()) cont =file.readlines() print(cont[n])#your code goes here file.close()
26th Oct 2021, 9:13 PM
Edgar Rodas
Edgar Rodas - avatar
0
my solution: file = open("/usercode/files/pull_ups.txt") n = int(input()) print(file.readlines()[n]) file.close()
12th Dec 2021, 12:13 AM
daysweri services