Category: Python Programming Examples

python tutorials and learn python

Created with Sketch.

Python program to print all positive numbers in a range

Python Program to Print All Positive Numbers in a Range Introduction In this blog post, we will discuss and implement a Python program to print all positive numbers within a specified range. The program will take two integer values as input, representing the lower and upper bounds of the range. It will then identify and…
Read more

Python program to print negative numbers in a list

Python Program to Print Negative Numbers in a List Negative numbers are a common element in data analysis and processing. In this blog post, we’ll explore a Python program that focuses on identifying and printing negative numbers within a given list. This program is not only practical for data manipulation but also serves as an…
Read more

Python program to print positive numbers in a list

Python Program: Print Positive Numbers in a List In this blog post, we’ll explore a Python program that prints positive numbers from a given list. The program takes a list of numbers as input and outputs only the positive ones. We will provide a step-by-step explanation of the algorithm, showcase the Python code, and include…
Read more

Python program to count Even and Odd numbers in a List

Python program to count Even and Odd numbers in a List Given a list of numbers, write a Python program to count Even and Odd numbers in a List. Example: Input: list1 = [2, 7, 5, 64, 14] Output: Even = 3, odd = 2 Input: list2 = [12, 14, 95, 3] Output: Even =…
Read more

Python program to print all odd numbers in a range

Python program to print all odd numbers in a range Given starting and end points, write a Python program to print all odd numbers in that given range. Example: Input: start = 4, end = 15 Output: 5, 7, 9, 11, 13, 15 Input: start = 3, end = 11 Output: 3, 5, 7, 9,…
Read more

Python program to print all even numbers in a range

Python program to print all even numbers in a range Given starting and end points, write a Python program to print all even numbers in that given range. Example: Input: start = 4, end = 15 Output: 4, 6, 8, 10, 12, 14 Input: start = 8, end = 11 Output: 8, 10 Example #1:…
Read more

Python program to print odd numbers in a List

Python program to print odd numbers in a List Given a list of numbers, write a Python program to print all odd numbers in given list. Example: Input: list1 = [2, 7, 5, 64, 14] Output: [7, 5] Input: list2 = [12, 14, 95, 3, 73] Output: [95, 3, 73] Using for loop : Iterate…
Read more

Python program to print even numbers in a list

Python program to print even numbers in a list Given a list of numbers, write a Python program to print all even numbers in given list. Example: Input: list1 = [2, 7, 5, 64, 14] Output: [2, 64, 14] Input: list2 = [12, 14, 95, 3] Output: [12, 14] Using for loop : Iterate each…
Read more

Python program to find N largest elements from a list

Python program to find N largest elements from a list Given a list of integers, the task is to find N largest elements assuming size of list is greater than or equal o N. Examples : Input : [4, 5, 1, 2, 9] N = 2 Output : [9, 5] Input : [81, 52, 45,…
Read more

Python program to find second largest number in a list

Python program to find the second largest number in a list Given a list of numbers, the task is to write a Python program to find the second largest number in given list. Examples: Input : list1 = [10, 20, 4] Output : 10 Input : list2 = [70, 11, 20, 4, 100] Output :…
Read more