This page contains Python programming examples that cover the concepts, including basic and simple number programs, string, List, series, etc. Apart from them, we also included the numpy array and matrix programs, area programs, and the pattern programs.
All these Python programs are explained with multiple examples, and we also did the code analysis. Please visit the Python tutorial to learn programming language with practical examples.
Basic Python Programs
The below section covers the basic programs and simple python programming examples.
- Python program for Hello World
- Python program to add Two Numbers
- Python program to subtract two numbers
- Python Program to Multiply Two numbers
- Python program for Arithmetic Operations
- Python program to print Calendar
- Python program to find Largest of 2 Numbers
- Python program to find Largest of 3 Numbers
- Python program for Leap Year
- Python Program to Print Negative Numbers in a Range
- Python Program to Print Positive Numbers in a Range
- Python program to find Positive or Negative
- Python program to check Number Divisible by 5 and 11
- Python Program to Find the Sum and Average Of Three Numbers
- Python Program to Find the Average Of Two Numbers
- Python Program to Get Current Date and Time
Math Programs
- Python program to find the Cube of a Number
- Python program to find Profit Or Loss
- Python program to find the Square of a Number
- Python program to find the Square root of a Number
- Python Program to find all divisors of an integer
- Python Program to Find Compound Interest
- Python Program to Calculate Electricity Bill
- Python Program to Find Distance Between Two Points
- Python program to find the Power of a Number
- Python program for Multiplication Table
- Python Program to find Roots of a Quadratic Equation
- Python Program to find Student Grade
- Python Program to find Simple Interest
- Python program to find the Total Average & Percentage of 5 Subjects
- Python Program to Make a Simple Calculator
Even, Odd, and Natural Number Programs
The following programs will accept the user inputs and find the Sum and average of even, odd, and natural numbers.
- Python Program to find Odd or Even
- Python program to Print Natural number 1 to N
- Python program to Print Natural Numbers in Reverse Order
- Python program to Print Even Numbers from 1 to 100
- Python program to print Odd Numbers from 1 to 100
- Python Program to Print First 10 Even Natural Numbers
- Python Program to Print First 10 Natural Numbers
- Python Program to Print First 10 Natural Numbers in Reverse
- Python Program to Print First 10 Odd Natural Numbers
- Python Program to find the Sum and Average of Natural Numbers
- Python Program to Read 10 Numbers and Find their Sum and Average
- Python Program to Find the Sum of 10 Numbers and Skip Negative Numbers
- Python Program to Find the Sum of 10 Numbers until user enters Positive Numbers
- Python Program to find Sum of Natural Numbers
- Python Program to find Sum of Even Numbers
- Python Program to find the Sum and Average of Natural Numbers
- Python Program to find the Sum of Odd Numbers
- Python Program to find the sum of Even and Odd Numbers
- Python Program to Read 10 Numbers and Find their Sum and Average
Python Programming Examples on Series
- Python Program to Print Fibonacci Series
- Python program to find the Sum of Arithmetic Progression Series
- Python program to find the Sum of Geometric Progression Series
- Python program to Find the Sum of Series 1²+2²+3²+….+n²
- Python program to find Sum of Series 1³+2³+3³+….+n³
Advanced Number Programs
The following Python programming examples are helpful for working with Numbers.
- Python Program to do Arithmetic Calculations using Functions
- Python Program to Count Number of Digits in a Number
- Python Program to find Factors of a Number
- Python Program to find the Factorial of a Number
- Python program to print the First Digit of a Number
- Python program to print Last Digit in a Number
- Python program to find the GCD of Two Numbers
- Python program to find LCM of Two Numbers
- Python program to check a Palindrome Number
- Python Program to Print Palindrome Numbers from 1 to 100
- Python Program to Reverse a Number
- Python program to find the Sum of Digits in a Number
- Python Program to Swap Two Numbers
Armstrong, Prime, and Perfect Numbers programs
- Python Program to Check Armstrong Number
- Python program to check Perfect Number
- Python program to check Prime Number
- Python program to print Prime Numbers from 1 to 100
- Python program to find Prime Factors of a Number
- Python Program to Check Disarium Number
- Python Program to Print Disarium Numbers from 1 to 100
- Python Program to Check Happy Number
- Python Program to Print Happy Numbers from 1 to 100
- Python Program to Check Harshad Number
- Python Program to Print Harshad Numbers from 1 to 100
- Python Program to Check Krishnamurthy Number
- Python Program to Check Neon Number
- Python Program to Check Pronic Number
- Python Program to Print Pronic Numbers from 1 to 100
- Python Program to check Spy Number
- Python Program to check Strong Number
- Python program to print Strong Numbers from 1 to 100
Python Programming Examples on Characters
The below examples are used to work on characters.
- Python program to check Alphabet or not
- Python program to check Alphabet or Digit
- Python program to check Character is an Alphabet, Digit or Special Character
- Python program to check Digit or Not
- Python program to check Lowercase or not
- Python program to check Lowercase or Uppercase
- Python Program to check Uppercase or not
- Python program to check Vowel or Consonant
Python String Programs
The following are the list of Python programming examples on strings.
- Python Program for ASCII Value of a Single Character
- Python program to print ASCII Value of Total Characters in a String
- Python program to Concatenate Strings
- Python program to Convert String to Uppercase
- Python program to Convert String to Lowercase
- Python program to Copy a String
- Python program to check Palindrome or Not
- Python Program to Check If Two Strings are Anagram
- Python program to Print the First Occurrence of a Character in a String
- Python program to Print the Last Occurrence of a Character in a String
- Python program to Print Characters in a String
- Python program to find String Length
- Total Occurrence of a Character in a string
- Toggle Characters Case
String Reverse, Replace, Count, and Remove Programs
- Python program to Count the Occurrence of a Character in a String
- Python Program to Count Character Frequency in a String
- Python program to Count Total Characters in a String
- Python program to Count the Total Number of Words in a String
- Python program to Count Vowels in a String
- Python program to Count Vowels and Consonants in a String
- Python program to Count Alphabets Digits and Special Characters in a String
- Python program to Replace Blank Space with Hyphen in a String
- Python program to Replace Characters in a String
- Python program to Remove Odd Characters in a String
- Python program to Remove Odd Index Characters in a String
- Python program to Remove the First Occurrence of a Character in a String
- Python program to Remove Last Occurred Character in a String
- Python Program to Remove Punctuations from a String
- Python program to Reverse a String
Python List Programs
The following are the List of Python Programming Examples on Lists.
- Python Program to Append an Item to a List
- Python Program to access List Index and Values
- Python Program to add two Lists
- Python Program to Change List Items
- Python Program for Arithmetic Operations on Lists
- Python Program to Calculate the Average of List Items
- Python Program to Clear a List
- Python Program to check List is Empty or Not
- Python Program to Check if the Element Exists in a List
- Python Program to Clone or Copy a List
- Python Program to Count Occurrence of an element in a List
- Python program to Count Even and Odd Numbers in a List
- Python program to Count Positive and Negative Numbers in a List
- Python program to find Length of a List
- Python program to find the List Difference
- Python Program to Find the Average of a List
- Python Program to Merge Two Lists
- Python List Multiplication Program
- Python program to find the Sum of All List Elements
- Sum and Average of a List
- Sum of Even and Odd List Numbers
- Left Rotate a List by n
- Right Rotate a List by n
- Remove an item from a List
- Remove the First element from a List
- Remove the Last Element from a List
- Iterate Over List Items
- Interchange First and Last Elements in a List
- Swap two items in a List
List Sort, Remove, Reverse, Print Items Programs
- Python program to Print Elements in a List
- Python Program to Print List Items in Reverse Order
- Python Program to Print List Items Greater Than Average
- Python Program to Print List Items at Even Position
- Python Program to Print List Items at Odd Position
- Python Program to Print Even Numbers in a List
- Python program to Print Odd List Numbers
- Python program to Put Even and odd Numbers in Separate List
- Python program to Print Positive Numbers
- Python program to Print Negative Numbers
- Python program to Put Positive and Negative Numbers in Separate List
- Python program to Print the Largest Number in a List
- Python program to Print the Second Largest Number in a List
- Python program to Print the Largest and Smallest Number
- Python program to Print the Smallest Element in a List
- Python program to Remove Duplicates from List
- Python program to Remove Even Numbers in a List
- Python program to Reverse List Items
- Python program to Sort List Items in Ascending Order
- Python Program to Sort List Items in Descending Order
Python Programming Examples on Tuples
- Python Program to add an Item to a tuple
- Python Program to create a Tuplea
- Python Program to create Tuple of Different Types
- Python Program to Find Tuple Length
- Python Program to Remove an Item from Tuple
- Python Program to Slice a Tuple
- Python Program to Unpack Tuple Items
- Python Program to Create a Tuple with Numbers
- Python Program to Check Item exists in Tuple
- Python Program to Find Sum of Even and Odd Numbers in Tuple
- Python Program to Find Sum of Tuple Items
- Python Program to Reverse Tuple
- Count Positive and Negative Numbers in a Tuple
- Count Even and Odd Numbers in Tuple
Tuple Items printing programs
- Get Tuple Items
- Python Program to Print Tuple using string formatting
- Python Program to Print Even Numbers in Tuple
- Python Program to Print Negative Numbers in Tuple
- Python Program to Print Positive Numbers in Tuple
- Python Program to Print Odd Numbers in Tuple
- Python Program to Print Smallest Item in a Tuple
- Python Program to Print Largest Item in a Tuple
- Python Program to Find Largest and Smallest Item in a Tuple
- Python Program to Print Tuple Items
Python Dictionary Programs
- Python Program to Add Key-Value Pair to a Dictionary
- Python program to Check if a Given key exists in a Dictionary
- Python program to Count words in a String using Dictionary
- Python program to Create Dictionary of keys from 1 to n and values are square of keys
- Python program to Create Dictionary of Numbers 1 to n in (x, x*x) form
- Python program to 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 Programming Examples on Sets
The sets are the collection of unordered items, and they don’t allow duplicates. The following programs help you understand the sets in detail.
- Python Program to create a Set
- Python program to Count Even and Odd Numbers in Set
- Python program to Count Positive and Negative Numbers in Set
- Python program to Iterate Set Items
- Python program to Print Largest Set Item
- Python program to find Length of a set
- Python program to Print Even Numbers in Set
- Python program to Print Negative Numbers in Set