[Solved] Error when writing file

Here a short answer : the value that you want is ‘w’ which is a string but in line 3-5 you are executing code for integer using the list,length and index of list Rather than this try to code: write() with an string Then It will work 1 solved Error when writing file

[Solved] Writing integers into a new file

You are printing the last value only. So you are getting the result only 13.You have to write the value in the for loop. b = open(‘new’, ‘w’) for n in [4, 7, 8, 10, 6, 3, 5, 13]: if n > 5: print(n) b.write(n) 1 solved Writing integers into a new file