This page contains the list of Python programming examples which covers the concepts including basic and simple python programs, number programs, string programs, List Programs, series programs etc.
Basic Python Programs
This section covers the basic and simple python programming examples. Please visit the python tutorial to learn python programming with practical examples
- Python program to print Hello World
- Python program to add Two Numbers
- Python program for Arithmetic Operations
- Python program to print Calendar
- Python program to find Cube of a Number
- Python program to find Largest of 2 Numbers
- Python program to find Largest of 3 Numbers
- Python program to Print Natural number 1 to N
- Print Natural Number in Reverse Order
- Sum and Average of Natural Numbers
- Leap Year
- Odd or Even
- Even Numbers from 1 to 100
- Odd Numbers from 1 to 100
- Positive or Negative
- Profit Or Loss
- Square of a Number
- Square root of a Number
- Compound Interest
- Number is Divisible by 5 and 11
- Power of a Number
- Multiplication Table
- Roots of a Quadratic Equation
- Student Grade
- Simple Interest
- Electricity Bill
- Total Average & Percentage of 5 Subjects
Python Sum Programs
The following Python programs will find Sum of
- Python Program to Print Natural Numbers
- Sum and Average of Natural Numbers
- Python Program to print Even Numbers
- Odd Numbers
- Even and Odd Numbers
Advanced Python Number Programs
The following python programming examples are helpful to work with Numbers
- Python Program to Check Armstrong Number
- Python Program to Count Number of Digits in a Number
- Python Fibonacci Series program
- Python example to find Factors of a Number
- python example to find Factorial of a Number
- First Digit of a Number
- GCD of Two Numbers
- Last Digit in a Number
- LCM of Two Numbers
- Natural Numbers in Reverse Order
- Palindrome Program
- Palindrome numbers from 1 to 100
- Perfect Number
- Prime Number
- Prim Numbers from 1 to 100
- Prime Factors of a Number
- Reverse a Number
- Strong Number
- Strong Numbers from 1 to 100
- Sum of Digits in a Number
- Swap Two Numbers
Python Programming examples on Characters
Below python examples are used to work on characters
- Python Program to check Alphabet or not
- Python example to check Alphabet or Digit
- Character is an Alphabet, Digit or Special Character
- Digit or Not
- Lowercase or not
- Lowercase or Uppercase
- Uppercase or not
- Vowel or Consonant
Python String Programs
The following are the list of python programming examples on strings.
- ASCII Value of a Single Character
- ASCII Value of Total Characters in a String
- Concatenate Strings
- Convert String to Uppercase
- Convert String to Lowercase
- Copy String
- Counting Occurrence of a Character in a String
- Count Total Characters in a String
- Count Total Number of Words in a String
- Counting Vowels in a String
- Count Vowels and Consonants in a String
- Count Alphabets Digits and Special Characters in a String
- First Occurrence of a Character in a String
- Last Occurrence of a Character in a String
- Palindrome or Not
- Print Characters in a String
- Replace Blank Space with Hyphen in a String
- Replace Characters in a String
- Remove Odd Characters in a String
- Remove Odd Index Characters in a String
- Removing First Occurrence of a Character in a String
- Remove Last Occurred Character in a String
- Reverse a String
- String Length
- Total Occurrence of a Character in a String
- Toggle Characters Case in a String
Python List Programs
The following are the List of Python Programming Examples on Lists.
- Python Program to access List Index and Values
- Python example to add two Lists
- Python example for Arithmetic Operations on Lists
- Python example to check List is Empty or Not
- Clone or Copy a List
- Count Even and Odd Numbers in a List
- Count Positive and Negative Numbers in a List
- Largest Number in a List
- Largest and Smallest Number
- Length of a List
- List Difference
- List Multiplication Program
- Print Elements in a List
- Print Even Numbers in a List
- Printing Odd Numbers
- Print Positive Numbers
- Print Negative Numbers
- Put Even and odd Numbers in Separate List
- Put Positive and Negative Numbers in Separate List
- Remove Duplicates from List
- Remove Even Numbers in a List
- Reverse List Items
- Second Largest Number in a List
- Sort Elements in Ascending Order
- Smallest Element in a List
- Sum of All Elements
- Sum of Even and Odd Numbers in a List
Python Programming Examples on Tuples
- Python Program to add an Item to tuple
- Create a Tuple
- Create Tuple of Different Types
- Create a Tuple with Numbers
- Check Item exists in Tuple
- Convert List to Tuple
- Convert Tuple to Dictionary
- Convert Tuple to String
- Count Even and Odd Numbers in Tuple
- Count Positive and Negative Numbers in Tuple
- Get or Access Tuple Items
- Index of a Tuple Item
- Largest Item in a Tuple
- Largest and Smallest Item in a Tuple
- Length of a Tuple
- Print Even Numbers in Tuple
- Print Negative Numbers in Tuple
- Print Odd Numbers in Tuple
- Print Positive Numbers in Tuple
- Print Tuple Items
- Print Tuple using string formatting
- Remove an Item from Tuple
- Reverse Tuple
- Smallest Item in a Tuple
- Sum of Even and Odd Numbers in Tuple
- Sum of Tuple Items
- Tuple Slicing
- Unpack Tuple Items
Python Dictionary Programs
- Python Program to add Key-Value Pair to a Dictionary
- Check if a Given key exists in a Dictionary
- Count words in a String using Dictionary
- Create Dictionary of keys from 1 to n and values are square of keys
- Create Dictionary of Numbers 1 to n in (x, x*x) form
- Map two lists into a Dictionary
- Merge Two Dictionaries
- Multiply All Items in a Dictionary
- Remove Given Key from a Dictionary
- Sum of Items in a Dictionary
Python Set Programs
The Python sets are the collection of unordered items, and they don’t allow duplicates. The following Python programs help you understand the sets in detail.
- Python Program to create a Set
- Count Even and Odd Numbers in Set
- Count Positive and Negative Numbers in Set
- Iterate Set Items
- Largest Set Item
- Length of a set
- Print Even Numbers in Set
- Print Negative Numbers in Set
- Print Odd Numbers in Set
- Print Positive Numbers in Set
- Sum of Even and Odd Numbers in Set
- Smallest Set Item
Python Programs on Numpy Array
Like other programming languages, Python doesn’t support arrays. However, Python has a Numpy module that supports arrays. In these Python programs, we use this numpy module to write array and matrix programs. The following are list of Python programs on numpy array and the matrix.
- Python Program to Perform Arithmetic Operations on Array
- Copy an Array
- Count Even and Odd Numbers in an Array
- Count Positive and Negative Numbers in an Array
- Largest Number in an Array
- Length of a Numpy Array
- Minimum and Maximum Value in an Array
- Print Even Numbers in an Array
- Print Odd Numbers in an Array
- Print Negative Numbers in an Array
- Print Numpy Array Items
- Print Positive Numbers in an Array
- Reverse the Numpy Array
- Second Largest in an Array
- Smallest Number in an Array
- Sort Array in Ascending Order
- Sort Array in Descending Order
- Sum of Numpy Array Items
- Sum of Even and Odd Numbers in an Array
- Unique Items in an Array
Python Examples on Area and Volume
This sections covers python programs on Areas, Volume and Surface Area with examples
Python Area Programs
- Python Program to find the Area of a Circle
- Diameter, Circumference, and Area Of a Circle
- Equilateral Triangle
- Check Triangle is Valid or Not
- Find angle of a Triangle if two angles are given
- Isosceles Triangle Area
- Triangle Area
- Triangle area using base and height
- Trapezoid
- Parallelogram Area
- Rectangle Area using length and width
- Rectangle Perimeter using length and width
- Rectangle
- Right Angled Triangle
Python Volume and Surface Area Examples
Python Programs on Series
- Sum of Arithmetic Progression Series
- Sum of Geometric Progression Series
- Find Sum of Series 1²+2²+3²+….+n²
- Sum of Series 1³+2³+3³+….+n³
Python Conversion Programs
Some of the popular conversion examples in Python.
- Program to Convert Celsius to Fahrenheit
- Centimeters to Meters and Kilometers
- Decimal to Binary, octal, and Hexadecimal
- Kilometers to Miles
- Kilometers to Meters, Centimeters, and Millimeters
- Miles to Kilometers
Python Pattern Programs
The following Python Programming examples show you the pattern programs. This section uses Star patterns and 0, 1 patterns.
- Bubble Sort
- 1 and 0 in Alternative Columns
- 1 and 0 in Alternative Rows
- Box Pattern of Numbers 1 and 0
- Hollow Box Pattern of Numbers of 1 and 0
- Diamond Star Pattern
- Hollow Diamond Star Pattern
- Exponentially Increasing Star Pattern
- Floyd’s Triangle
- Half Diamond Star Pattern
- Hollow Half Diamond Star Pattern
- Mirrored Half Diamond Star Pattern
- Inverted Pyramid Star Pattern
- Inverted Right Triangle of Numbers
- Inverted Right Triangle Star Pattern
- Hollow Inverted Right Triangle
- Mirrored Right Triangle Star Pattern
- Rectangle Star Pattern
- Hollow Rectangle Star Pattern
- Reverse Mirrored Right Triangle Star Pattern
- Right Triangle Number Pattern
- Right Angled Triangle Star Pattern
- Hollow Right Triangle Star Pattern
- Hollow Rhombus Star Pattern
- Mirrored Rhombus Star Pattern
- Hollow Mirrored Rhombus Star Pattern
- Square Star Pattern
- Square Number Pattern
- Square Star Hollow Pattern
- Hollow Square Star With Diagonals