Question: Write a Python program that calculates the sum of the first N of even numbers, where N is a positive integer entered by the user.
Write a Python program that calculates the sum of the first N of even numbers, where N is a
positive integer entered by the user. Ensure that only positive natural numbers integer values
are accepted. Use a for loop to iterate from to N inclusively, and calculate the running total of
even numbers.
After calculating the sum, print the total sum of the first N even numbers.
Submit your Python script py on CodeGrade named: SUpy
Example:
If the user enters N the program should calculate the sum as and print the
result as The sum of the first even numbers is Use fstring formatting to print the output.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
