Question: write python code for Read N integers and find the sum of all positive numbers. Write a function def solution(N): that accepts an integer N.

write python code for

Read N integers and find the sum of all positive numbers.

Write a function def solution(N):

that accepts an integer N. The function should read N integers and return the sum of all positive numbers.

Input 4 2 3 -5 4

where,

  • First line represents a value of N.
  • Second and next lines contain N integers.

Output 9

Assume that,

  • The value of N within the range from [-10000 to 10000].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!