+ 1
Why it won't pass me in? Pyton 48.2 Practise "New Line"
Task from Python Core 48.2 "New Line": You are given the following list: names = ["John", "Oscar", "Jacob"] Complete the program to create a file where you write the names from the list, each on a new line, and separately output them. correct output: John Oscar Jacob ========= My code: names = ["John", "Oscar", "Jacob"] file = open("names.txt", "w+") for name in names: file.write(name + " \n") file.close() file= open("names.txt", "r") print(file.read()) file.close() my output: John Oscar Jacob where did I make mistake?
2 Respuestas
+ 4
Replace
" \n"
with
"\n"
0
that works!!!
Thank you so much!