Exercise 15: Handling TXT files

Let's test your ability to handle .txt files.

Problem Statement

Using data from the file data.txt that contains a list of numbers, write a file that tells whether the number at each line is an even number or an odd number.

Input

A file named data.txt that contains a list of numbers.

Output

A file names output/outData.txt that has even or odd written for each number of the input file.

Sample Input

A file data.txt that looks like this:

1
2
3

Sample Output

A file output/outData.txt that looks like this:

odd
even
odd

Test Yourself

Write your code in the given area. If you get stuck, you can look at the solution.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy