- 4

Python

Question: Get five names from the user and store them in a file named “names.txt”

22nd Jan 2022, 9:15 PM
Zain Assad
2 Answers
+ 1
Please link your code. You can get the names using a loop and you'll need to know basic file operations (lessons 46-49 of Python core course)
22nd Jan 2022, 9:17 PM
Lisa
Lisa - avatar
0
names=[ ] for i in range(5): names.append(input ('Name:')) with open('names.txt','w') as f: f.write('\n'.join(names))
23rd Jan 2022, 11:43 AM
Gayashan Pananwala
Gayashan Pananwala - avatar