Question: Write a Python program with a function called harmonic _ sum ( n ) that calculates the sum of harmonic series of up to n

Write a Python program with a function called harmonic_sum(n) that calculates the sum of harmonic series of up to n numbers, and returns the result value using recursion.
Harmonic series is defined as 1+1/2+1/3+1/4+...(n terms)
Example of program scenario:
Program Prompt: Enter a non-negative integer:
User Response: 4
Program Response: Sum of harmonic series of up to 4 numbers is 2.083333333333333
# Write your program here
def harmonic_sum(n):
pass
print(harmonic_sum(4))

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 Programming Questions!