file=open('num.txt', 'w') name=[] for i in range(5): n=input("Enter Name: ") file.writelines(name) name.append(n+'\n') file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

file=open('num.txt', 'w') name=[] for i in range(5): n=input("Enter Name: ") file.writelines(name) name.append(n+'\n') file

Kaya ho ga iss me

24th Jul 2022, 3:05 AM
Gunda Freefire
Gunda Freefire - avatar
2 Answers
+ 5
Gunda Freefire , 3 issues to fix: > code / code block that should run in the for loop has to be indented > writelines() should be outside / after of the loop > last line should close the file
24th Jul 2022, 6:15 AM
Lothar
Lothar - avatar
+ 1
Karna kya hai? Complete code kaha hai?
24th Jul 2022, 3:19 AM
A͢J
A͢J - avatar