In the previous article, we have discussed Python Program to Find Sum of Series 1^1/1+2^2/2+3^3/3…+n^n/n

Given a number N and the task is to find the sum of series** (1^1/1!+2^2/2!+3^3/3!…+N^N/N!)** till the given number N in Python.

**Examples:**

**Example1:**

**Input:**

Given Number (Limit) = 6

**Output:**

The above series sum till the given number N{ 6 } = 109.00833333333333

**Example2:**

**Input:**

Given Number (Limit) = 15

**Output:**

The above series sum till the given number N{ 15 } = 541239.9325756768

- Python Program to Find Sum of Series 1^1/1+2^2/2+3^3/3…+n^n/n
- Python Program to Find the Sum of Series 1+X+X^2/2…+X^N/N
- Python Program to Find Minimum Number of Steps to Reach M from N

## Program to Find Sum of Series 1^1/1!+2^2/2!+3^3/3!…+n^n/n! in Python

Below are the ways to find the sum of series** (1^1/1!+2^2/2!+3^3/3!…+N^N/N!)** till the given number N in Python:

### Method #1: Using For Loop (Static Input)

**Approach:**

- Import math module using the import keyword.
- Give the number N (Limit) as static input and store it in a variable.
- Take a variable to say
**rsltseries_summ**and initialize its value to 0.0 (Floating point number). - Take another variable to say
**factl_rslt**and initialize its value to 1 - Loop from 1 to the given number using the for loop.
- Inside the loop, multiply the iterator value with the above
**factl_rslt**and store it in the same variable. - Calculate the value of the iterator raised to the power itself and divided by the above factorial result using the pow() function.
- Store it in another variable.
- Add the above result to the
**rsltseries_summ**and store it in the same variable. - Print the sum of series till the given number N.
- The Exit of the Program.

**Below is the implementation:**

# Import math module using the import keyword. import math # Give the number N(limit) as static input and store it in a variable. gvn_numb = 6 # Take a variable to say rsltseries_summ and initialize its value to 0.0 # (Floating point number) rsltseries_summ = 0.0 # Take another variable to say factl_rslt and initialize its value to 1 factl_rslt = 1 # Loop from 1 to the given number using the for loop. for itr in range(1, gvn_numb+1): # Inside the loop, multiply the iterator value with the above factl_rslt and # store it in the same variable. factl_rslt *= itr # calculate the value of the iterator raised to the power itself and # divided by the above factorial result using the pow() function. # Store it in another variable. a = pow(itr, itr) / factl_rslt # Add the above result to the rsltseries_summ and store it in the same variable. rsltseries_summ += a # Print the sum of series till the given number N. print( "The above series sum till the given number N{", gvn_numb, "} = ", rsltseries_summ)

**Output:**

The above series sum till the given number N{ 6 } = 109.00833333333333

### Method #2: Using For loop (User Input)

**Approach:**

- Import math module using the import keyword.
- Give the number N (Limit) as user input using the int(input()) function and store it in a variable.
- Take a variable to say
**rsltseries_summ**and initialize its value to 0.0 (Floating point number). - Take another variable to say
**factl_rslt**and initialize its value to 1 - Loop from 1 to the given number using the for loop.
- Inside the loop, multiply the iterator value with the above
**factl_rslt**and store it in the same variable. - Calculate the value of the iterator raised to the power itself and divided by the above factorial result using the pow() function.
- Store it in another variable.
- Add the above result to the
**rsltseries_summ**and store it in the same variable. - Print the sum of series till the given number N.
- The Exit of the Program.

**Below is the implementation:**

# Import math module using the import keyword. import math # Give the number N (Limit) as user input using the int(input()) function and # store it in a variable. gvn_numb = int(input("Enter some Random Number = ")) # Take a variable to say rsltseries_summ and initialize its value to 0.0 # (Floating point number) rsltseries_summ = 0.0 # Take another variable to say factl_rslt and initialize its value to 1 factl_rslt = 1 # Loop from 1 to the given number using the for loop. for itr in range(1, gvn_numb+1): # Inside the loop, multiply the iterator value with the above factl_rslt and # store it in the same variable. factl_rslt *= itr # calculate the value of the iterator raised to the power itself and # divided by the above factorial result using the pow() function. # Store it in another variable. a = pow(itr, itr) / factl_rslt # Add the above result to the rsltseries_summ and store it in the same variable. rsltseries_summ += a # Print the sum of series till the given number N. print( "The above series sum till the given number N{", gvn_numb, "} = ", rsltseries_summ)

**Output:**

Enter some Random Number = 15 The above series sum till the given number N{ 15 } = 541239.9325756768

Remediate your knowledge gap by attempting the Python Code Examples regularly and understand the areas of need and work on them.