In the previous article, we have discussed Python Program to Print Series -1 4 -7 10 -13 16 -19…n

Given a number N and the task is to print the series** ( 10, 5, 60, 15, 110 …N)** till the given number N in Python.

**Examples:**

**Example1:**

**Input:**

Given Number (Limit) = 14

**Output:**

The above series till the given number{ 14 } is : 10 5 60 15 110 25 160 35 210 45 260 55 310 65

**Example2:**

**Input:**

Given Number (Limit) = 9

**Output:**

The above series till the given number{ 9 } is : 10 5 60 15 110 25 160 35 210

## Program to Print Series 10, 5, 60, 15, 110 …N in Python

Below are the ways to print the series** ( 10, 5, 60, 15, 110 …N)** till the given number N in Python:

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

**Approach:**

- Give the number N (Limit) as static input and store it in a variable.
- Take a variable to say
**itr**and initialize its value to 1. - Take another variable say
**p**and initialize its value to 10. - Take another variable say
**q**and initialize its value to 5. - Loop until the above-declared variable itr value is less than or equal to the given number using the while loop.
- Inside the loop, check if the above variable itr value is even or not using the if conditional statement.
- If it is true, then print the value of
**q**separated by spaces. - Increment the above
**q**value by 10 and store it in the same variable. - Else, print the value of
**p**separated by spaces. - Increment the above
**p**value by 50 and store it in the same variable. - Increment the above
**itr**value by 1. - The Exit of the Program.

**Below is the implementation:**

# Give the number N(limit) as static input and store it in a variable. gvn_numb = 14 # Take a variable to say itr and initialize its value to 1. itr = 1 # Take another variable say p and initialize its value to 10. p = 10 # Take another variable say q and initialize its value to 5. q = 5 print("The above series till the given number{", gvn_numb, "} is :") # Loop until the above-declared variable itr value is less than or equal to the # given number using the while loop. while(itr <= gvn_numb): # Inside the loop, check if the above variable itr value is even or not using the # if conditional statement. if(itr % 2 == 0): # If it is true, then print the value of q separated by spaces. print(q, end=" ") # Increment the above q value by 10 and store it in the same variable. q += 10 else: # Else, print the value of p separated by spaces. print(p, end=" ") # Increment the above p value by 50 and store it in the same variable. p += 50 # Increment the above itr value by 1. itr += 1

**Output:**

The above series till the given number{ 14 } is : 10 5 60 15 110 25 160 35 210 45 260 55 310 65

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

**Approach:**

- Give the number N (Limit) as user input using the int(input()) function and store it in a variable.
- Take a variable to say
**itr**and initialize its value to 1. - Take another variable say
**p**and initialize its value to 10. - Take another variable say
**q**and initialize its value to 5. - Loop until the above-declared variable itr value is less than or equal to the given number using the while loop.
- Inside the loop, check if the above variable itr value is even or not using the if conditional statement.
- If it is true, then print the value of
**q**separated by spaces. - Increment the above
**q**value by 10 and store it in the same variable. - Else, print the value of
**p**separated by spaces. - Increment the above
**p**value by 50 and store it in the same variable. - Increment the above
**itr**value by 1. - The Exit of the Program.

**Below is the implementation:**

# 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 itr and initialize its value to 1. itr = 1 # Take another variable say p and initialize its value to 10. p = 10 # Take another variable say q and initialize its value to 5. q = 5 print("The above series till the given number{", gvn_numb, "} is :") # Loop until the above-declared variable itr value is less than or equal to the # given number using the while loop. while(itr <= gvn_numb): # Inside the loop, check if the above variable itr value is even or not using the # if conditional statement. if(itr % 2 == 0): # If it is true, then print the value of q separated by spaces. print(q, end=" ") # Increment the above q value by 10 and store it in the same variable. q += 10 else: # Else, print the value of p separated by spaces. print(p, end=" ") # Increment the above p value by 50 and store it in the same variable. p += 50 # Increment the above itr value by 1. itr += 1

**Output:**

Enter some Random Number = 9 The above series till the given number{ 9 } is : 10 5 60 15 110 25 160 35 210

Find the best practical and ready-to-use Python Programming Examples that you can simply run on a variety of platforms and never stop learning.