Python | Sololearn: Learn to code for FREE!



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

1/22/2022 9:15:32 PM

Zain Assad

2 Answers

New Answer


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)


names=[ ] for i in range(5): names.append(input ('Name:')) with open('names.txt','w') as f: f.write('\n'.join(names))