-->
Python Programs

Python Programs

 Python Programming Examples

This page contains Python programming examples that cover the concepts, including basic and simple python programs, number programs, string programs, List Programs, series programs, 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 python programming with practical examples.

Basic Python Programs

This section covers the basic and simple python programming examples.

  1. Python program for Hello World
  2. Python program to add Two Numbers
  3. Python program for Arithmetic Operations
  4. Python program to print Calendar
  5. Python program to find Cube of a Number
  6. Python program to find Largest of 2 Numbers
  7. Python program to find Largest of 3 Numbers
  8. Python program to Print Natural number 1 to N
  9. Python program for Leap Year
  10. Python program to find Odd or Even
  11. Python program to print Even Numbers from 1 to 100
  12. Python program to print Odd Numbers from 1 to 100
  13. Python program to find Positive or Negative
  14. Python program to find Profit Or Loss
  15. Python program to find Square of a Number
  16. Python program to find Square root of a Number
  17. Python Program to find all divisors of an integer
  18. Python Program to find Compound Interest
  19. Python program to check Number Divisible by 5 and 11
  20. Python program to find Power of a Number
  21. Python program for Multiplication Table
  22. Python example to find Roots of a Quadratic Equation
  23. Python example to find Student Grade
  24. Python example to find Simple Interest
  25. Python Program to Print First 10 Even Natural Numbers
  26. Python Program to Print First 10 Natural Numbers
  27. Python Program to Print First 10 Natural Numbers in Reverse
  28. Python Program to Print First 10 Odd Natural Numbers
  29. Python program to Print Natural number 1 to N
  30. Python program to print Natural Numbers in Reverse Order
  31. Python example to find Sum and Average of Natural Numbers
  32. Python example to Calculate Electricity Bill
  33. Python program to find Total Average & Percentage of 5 Subjects
  34. Python Program to Get Current Date and Time

Python Sum Programs

The following Python programs will find the Sum

  1. Python Program to find Sum of Natural Numbers
  2. Python Program to find Sum of Even Numbers
  3. Python example to find Sum and Average of Natural Numbers
  4. Python example to find Sum of Odd Numbers
  5. Python example to find sum of Even and Odd Numbers

Advanced Python Number Programs

The following python programming examples are helpful to work with Numbers

  1. Python Program to Check Armstrong Number
  2. Python Program to Count Number of Digits in a Number
  3. Python example for Fibonacci Series
  4. Python example to find Factors of a Number
  5. Python example to find Factorial of a Number
  6. Python program to print First Digit of a Number
  7. Python program to print Last Digit in a Number
  8. Python program to find GCD of Two Numbers
  9. Python program to find LCM of Two Numbers
  10. Python Palindrome Program
  11. Python program to print Palindrome numbers from 1 to 100
  12. Python program to check Perfect Number
  13. Python program to check Prime Number
  14. Python program to print Prime Numbers from 1 to 100
  15. Python program to find Prime Factors of a Number
  16. Python Program to Reverse a Number
  17. Python Program to check Strong Number
  18. Python program to print Strong Numbers from 1 to 100
  19. Python program to find Sum of Digits in a Number
  20. Python Program to Swap Two Numbers

Python Programming examples on Characters

Below python examples are used to work on characters

  1. Python program to check Alphabet or not
  2. Python program to check Alphabet or Digit
  3. Python program to check Character is an Alphabet, Digit or Special Character
  4. Python program to check Digit or Not
  5. Python program to check Lowercase or not
  6. Python program to check Lowercase or Uppercase
  7. Python Program to check Uppercase or not
  8. Python program to check Vowel or Consonant

Python String Programs

The following are the list of python programming examples on strings.

  1. Python example for ASCII Value of a Single Character
  2. Python program to print ASCII Value of Total Characters in a String
  3. Python program to Concatenate Strings
  4. Python program to Convert String to Uppercase
  5. Python program to Convert String to Lowercase
  6. Python program to Copy a String
  7. Python program to Count Occurrence of a Character in a String
  8. Python program to Count Total Characters in a String
  9. Python program to Count Total Number of Words in a String
  10. Python program to Count Vowels in a String
  11. Python program to Count Vowels and Consonants in a String
  12. Python program to Count Alphabets Digits and Special Characters in a String
  13. Python program to Print First Occurrence of a Character in a String
  14. Python program to Print Last Occurrence of a Character in a String
  15. Python program to check Palindrome or Not
  16. Python program to Print Characters in a String
  17. Python program to Replace Blank Space with Hyphen in a String
  18. Python program to Replace Characters in a String
  19. Python program to Remove Odd Characters in a String
  20. Python program to Remove Odd Index Characters in a String
  21. Python program to Remove First Occurrence of a Character in a String
  22. Python program to Remove Last Occurred Character in a String
  23. Python program to Reverse a String
  24. Python program to find String Length
  25. Python program to find Total Occurrence of a Character in a String
  26. Python program to Toggle Characters Case in a String

Python List Programs

The following are the List of Python Programming Examples on Lists.

  1. Python example to access List Index and Values
  2. Python example to add two Lists
  3. Python example for Arithmetic Operations on Lists
  4. Python example to check List is Empty or Not
  5. Python example to Clone or Copy a List
  6. Python program to Count Even and Odd Numbers in a List
  7. Python program to Count Positive and Negative Numbers in a List
  8. Python program to Print Largest Number in a List
  9. Python program to Print Largest and Smallest Number
  10. Python program to find Length of a List
  11. Python program to find List Difference
  12. Python List Multiplication Program
  13. Python program to Print Elements in a List
  14. Python program to Even Numbers in a List
  15. Python program to Print Odd List Numbers
  16. Python program to Print Positive Numbers
  17. Python program to Print Negative Numbers
  18. Python program to Put Even and odd Numbers in Separate List
  19. Python program to Put Positive and Negative Numbers in Separate List
  20. Python program to Remove Duplicates from List
  21. Python program to Remove Even Numbers in a List
  22. Python program to Reverse List Items
  23. Python program to Print Second Largest Number in a List
  24. Python program to Sort Elements in Ascending Order
  25. Python program to Print Smallest Element in a List
  26. Python program to find Sum of All Elements
  27. Python program to find Sum of Even and Odd Numbers in a List

Python Programming Examples on Tuples

  1. Python example to add an Item to tuple
  2. Python example to create a Tuple
  3. Python example to create Tuple of Different Types
  4. Python Program to Print Tuple using string formatting
  5. Python Program to Remove an Item from Tuple
  6. Python Program to Slice a Tuple
  7. Python Program to Unpack Tuple Items
  8. Python Program to Create a Tuple with Numbers
  9. Python Program to Convert Tuple to String
  10. Python Program to Convert Tuple to Dictionary
  11. Python Program to Check Item exists in Tuple
  12. Python Program to Find Largest and Smallest Item in a Tuple
  13. Python Program to Find Sum of Even and Odd Numbers in Tuple
  14. Python Program to Find Sum of Tuple Items
  15. Python Program to Reverse Tuple
  16. Count Positive and Negative Numbers in Tuple
  17. Count Even and Odd Numbers in Tuple
  18. Python Program to Convert List to Tuple
  19. Python Program to Print Even Numbers in Tuple
  20. Python Program to Print Negative Numbers in Tuple
  21. Python Program to Get Tuple Items
  22. Python Program to Print Positive Numbers in Tuple
  23. Python Program to Print Odd Numbers in Tuple
  24. Python Program to Find Smallest Item in a Tuple
  25. Python Program to Find Largest Item in a Tuple
  26. Python Program to Print Tuple Items
  27. Python Program to Find Tuple Length

Python Dictionary Programs

  1. Python example to add Key-Value Pair to a Dictionary
  2. Python program to Check if a Given key exists in a Dictionary
  3. Python program to Count words in a String using Dictionary
  4. Python program to Create Dictionary of keys from 1 to n and values are square of keys
  5. Python program to Create Dictionary of Numbers 1 to n in (x, x*x) form
  6. Python program to Map two lists into a Dictionary
  7. Python program to Merge Two Dictionaries
  8. Python program to Multiply All Items in a Dictionary
  9. Python program to Remove Given Key from a Dictionary
  10. Python program to find 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.

  1. Python Program to create a Set
  2. Python program to Count Even and Odd Numbers in Set
  3. Python program to Count Positive and Negative Numbers in Set
  4. Python program to Iterate Set Items
  5. Python program to Print Largest Set Item
  6. Python program to find Length of a set
  7. Python program to Print Even Numbers in Set
  8. Python program to Print Negative Numbers in Set
  9. Python program to Print Odd Numbers in Set
  10. Python program to Print Positive Numbers in Set
  11. Python program to find Sum of Even and Odd Numbers in Set
  12. Python program to find 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.

  1. Python Program to Perform Arithmetic Operations on Array
  2. Python example to Copy an Array
  3. Python example to Count Even and Odd Numbers in an Array
  4. Python example to find Largest Number in an Array
  5. Python program to Count Positive and Negative Numbers in an Array
  6. Python program to find Length of a Numpy Array
  7. Python program to find Minimum and Maximum Value in an Array
  8. Python program to Print Even Numbers in an Array
  9. Python program to Print Odd Numbers in an Array
  10. Python program to Print Negative Numbers in an Array
  11. Python program to Print Numpy Array Items
  12. Python program to Print Positive Numbers in an Array
  13. Python program to Reverse the Numpy Array
  14. Python program to find Second Largest in an Array
  15. Python program to Print Smallest Number in an Array
  16. Python program to Sort Array in Ascending Order
  17. Python program to Sort Array in Descending Order
  18. Python program to find Sum of Numpy Array Items
  19. Python program to find Sum of Even and Odd Numbers in an Array
  20. Python program to Print 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

  1. Python example to find the Area of a Circle
  2. Python Program to find Diameter, Circumference, and Area Of a Circle
  3. Python Program to find Equilateral Triangle Area
  4. Python Program to check Triangle is Valid or Not
  5. Python Program to Find angle of a Triangle if two angles are given
  6. Python Program for Isosceles Triangle Area
  7. Python Program for Triangle Area
  8. Python program to find Triangle area using base and height
  9. Python program to find Area of a Trapezoid
  10. Python Program for Parallelogram Area
  11. Python program to find Rectangle Area using length and width
  12. Python program to find Rectangle Perimeter using length and width
  13. Python program to find Area of a Rectangle
  14. Python program to find Area of a Right Angled Triangle
  15. Python program for Rhombus Area
  16. Python program for Rhombus Perimeter

Python Volume and Surface Area Examples

  1. Python Program to Find the Volume and Surface Area of a Sphere
  2. Python Program to Find the Volume and Surface Area of a Cylinder
  3. Python Program to Find the Volume and Surface Area of a Cube
  4. Python Program to Find the Volume and Surface Area of a Cone
  5. Python Program to Find the Volume and Surface Area of a Cuboid

Python Programs on Series

  1. Python program to find Sum of Arithmetic Progression Series
  2. Python program to find Sum of Geometric Progression Series
  3. Python program to find Find Sum of Series 1²+2²+3²+….+n²
  4. Python program to find Sum of Series 1³+2³+3³+….+n³

Python Conversion Programs

Some of the popular conversion examples in Python.

  1. Python program to Convert Celsius to Fahrenheit
  2. Python program to convert Centimeters to Meters and Kilometers
  3. Python example to convert Decimal to Binary, octal, and Hexadecimal
  4. Python Program to convert Kilometers to Miles
  5. Python example to convert Kilometers to Meters, Centimeters, and Millimeters
  6. Python example to convert Miles to Kilometers

Python Star Pattern Programs

The following Python Programming examples show you the pattern programs. This section uses Star patterns and 0, 1 patterns.

  1. Python example for Bubble Sort
  2. Python Program to Print Christmas Tree Star Pattern
  3. Python example to Print Diamond Star Pattern
  4. Python example to print Hollow Diamond Star Pattern
  5. Python example to print Exponentially Increasing Star Pattern
  6. Python example to print Floyd’s Triangle
  7. Python example to Print Half Diamond Star Pattern
  8. Python example to print Hollow Half Diamond Star Pattern
  9. Python example to print Mirrored Half Diamond Star Pattern
  10. Python example to Print Plus Star Pattern
  11. Python example to print Pyramid Star Pattern
  12. Python example to print Inverted Pyramid Star Pattern
  13. Python example to print Rectangle Star Pattern
  14. Python example to print Hollow Rectangle Star Pattern
  15. Python example to Print Right Angled Triangle Star Pattern
  16. Python example to print Hollow Right Triangle Star Pattern
  17. Python example to print Inverted Right Triangle Star Pattern
  18. Python example to print Hollow Inverted Right Triangle
  19. Python example to print Mirrored Right Triangle Star Pattern
  20. Python example to print Reverse Mirrored Right Triangle Star Pattern
  21. Python example to print Rhombus Star Pattern
  22. Python example to print Hollow Rhombus Star Pattern
  23. Python example to print Mirrored Rhombus Star Pattern
  24. Python example to print Hollow Mirrored Rhombus Star Pattern
  25. Python example to print Square Star Pattern
  26. Python example to print Square Star Hollow Pattern
  27. Python example to print Hollow Square Star With Diagonals
  28. Python Program to Print Downward Triangle Star Pattern
  29. Python Program to Print Left Pascals Star Triangle
  30. Python Program to Print Hollow Left Pascals Star Triangle
  31. Python Program to Print Right Pascals Star Triangle
  32. Python Program to Print Hollow Right Pascals Star Triangle
  33. Python program to Print Sandglass Star Pattern
  34. Python Program to Print Hollow Sandglass Star Pattern
  35. Python Program to Print H Star Pattern
  36. Python Program to Print V Star Pattern
  37. Python Program to Print Inverted V Star Pattern
  38. Python Program to Print W Star Pattern
  39. Python Program to print X Star Pattern
  40. Python Program to Print 8 Star Pattern

Python Programs on Number Pattern

  1. Python example for 1 and 0 in Alternative Columns
  2. Python example for 1 and 0 in Alternative Rows
  3. Python example to print Box Number Pattern of 1 and 0
  4. Python example to print Hollow Box Pattern of Numbers of 1 and 0
  5. Python Program to Print Pyramid Numbers Pattern
  6. Python example to print Right Triangle Number Pattern
  7. Python Program to Print Right Triangle of 1 and 0
  8. Python Program to Print Right Triangle of Incremented Numbers
  9. Python Program to Print Right Triangle of Numbers in Reverse
  10. Python Program to Print Right Triangle of Numbers in Sine Wave Pattern
  11. Python Program to Print Right Triangle of Mirrored Numbers Pattern
  12. Python example to Print Right Triangle of Consecutive Column Numbers
  13. Python example to Print Right Triangle of Consecutive Rows Numbers
  14. Python example to print Inverted Right Triangle of Numbers
  15. Python example to Print Inverted Right Triangle of Consecutive Numbers
  16. Python Program to Print Inverted Right Triangle of Decreasing Order Numbers
  17. Python Program to Print Inverted Right Triangle Numbers in Reverse
  18. Python Program to Print Downward Triangle Mirrored Numbers Pattern
  19. Python example to print Square Number Pattern
  20. Python example to Print Square with Same Numbers on all Sides
  21. Python example to Print Square with Same Numbers Rows and Columns
  22. Python Program to Print Square With Diagonal Numbers Pattern
  23. Python Program to Print Square of Left Decrement Numbers Pattern
  24. Python Program to Print Square of Right Increment Numbers Pattern
  25. Python Program to Print Diamond Number Pattern
  26. Python Program to Print a Simple Number Pattern
  27. Python program to Print Sandglass Number Pattern
  28. Python Program to Print Triangle Numbers Pattern
  29. Python Program to Print Triangle of Numbers in Reverse Pattern
  30. Python Program to Print Inverted Triangle Numbers Pattern
  31. Python Program to Print Triangle of Mirrored Numbers Pattern
  32. Python Program to Print K Shape Number Pattern
  33. Python Program to Print Pascal Triangle
  34. Python Program to Print Left Pascals Number Triangle
  35. Python Program to Print Right Pascals Number Triangle
  36. Python Program to Print Right Pascals Triangle of Multiplication Numbers Pattern
  37. Python Program to Print Left Arrow Numbers Pattern
  38. Python Program to Print Right Arrow Number Pattern

Python Alphabets Pattern Programs

  1. Python Program to Print Diamond Alphabets Pattern
  2. Python Program to Print Downward Triangle Alphabets Pattern
  3. Python Program to Print Downward Triangle Mirrored Alphabets Pattern
  4. Python Program to Print K Shape Alphabets Pattern
  5. Python Program to Print Left Arrow Alphabets Pattern
  6. Python Program to Print Pyramid Alphabets Pattern
  7. Python Program to Print Repeated Character Pattern
  8. Python Program to Print Right Arrow Alphabets Pattern
  9. Python Program to Print Right Pascals Triangle Alphabets Pattern
  10. Python Program to Print Right Triangle Alphabets Pattern
  11. Python Program to Print Right Triangle Character Pattern
  12. Python Program to Print Right Triangle of Alphabets in Reverse
  13. Python Program to Print Right Triangle of Consecutive Alphabets Pattern
  14. Python Program to Print Right Triangle of Consecutive Row Alphabets Pattern
  15. Python Program to Print Right Triangle of Incremental Alphabets Pattern
  16. Python Program to Print Right Triangle of Mirrored Alphabets Pattern
  17. Python Program to Print Mirrored Right Triangle Alphabets Pattern
  18. Python Program to Print Sandglass Alphabets Pattern
  19. Python Program to Print Square of Right Increment Alphabets Pattern
  20. Python Program to Print Triangle Alphabets Pattern
  21. Python Program to Print Triangle of Alphabets in Reverse Pattern
  22. Python Program to Print Triangle of Mirrored Alphabets Pattern
  23. Python Program to Print Triangle of Same Alphabets Pattern
  24. Python Program to Print Inverted Triangle Alphabets Pattern

0 Response to "Python Programs"

Post a Comment

Ads on article

Advertise in articles 1

advertising articles 2

Advertise under the article