Code coach question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Code coach question

Trying to solve the problem, but my solution doesn't work 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). Sample Input 4 Sample Output Day 4, 9 pull ups file = open("simple.txt", "r") n = int(input()) for line in file.readlines(n): print(line) file.close() help me please, thanks

9th Nov 2020, 7:26 AM
Ахан
Ахан - avatar
3 Answers
+ 1
Plz attached this code here Ахан it is free here why are you use file d=int(input ()) p=0 for i in range(0,d) p+=I print (p)
9th Nov 2020, 7:29 AM
Sâñtôsh
Sâñtôsh - avatar
0
Såñtösh file = open("simple.txt", "r") n = int(input()) for line in file.readlines(n): print(line) file.close()
9th Nov 2020, 7:31 AM
Ахан
Ахан - avatar
0
Såñtösh doesn't work
10th Nov 2020, 6:43 PM
Ахан
Ахан - avatar