← Back to Files
Question 430
Evens Into Their Own File
Evens Into Their Own File
Input: one line of whole numbers separated by spaces, no prompt. Split it with split() and write every number to all.txt on its own line. Read all.txt back into a list of int values (use append), then write only the even ones (the remainder operator % decides) to evens.txt, one per line, in the same order. Finally read evens.txt with readlines, print its lines with end="" and then <n> even number(s) with the number of lines.
Expected Output:
8 12 10 3 even number(s)
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Files
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.