logo

Crowdly

Write a Python program that: Prompts the user to enter 5 integer numbers ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Write a Python program that:

  1. Prompts the user to enter 5 integer numbers.

  2. Checks if each number is even.

  3. If the number is even, writes it to a file named even_numbers.txt, each on a new line.

  4. After all inputs, reads the file and:

    • Prints all even numbers

    • Prints their total sum

Hint: Don't use list in this question

Expected Output Example:

Enter number 1: 4

Enter number 2: 7

Enter number 3: 2

Enter number 4: 9

Enter number 5: 6

Even numbers in the file: 4 2 6

Total of even numbers: 12

More questions like this

Want instant access to all verified answers on elearn.squ.edu.om?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!