The best way to learn Python is by practicing examples. This page contains examples on basic concepts of Python. We encourage you to try these examples on your own before looking at the solution.

All the programs on this page are tested and should work on all platforms.

Want to learn Python by writing code yourself? Enroll in our Interactive Python Course for FREE.

  1. Python Program to Add Two Matrices
  2. Python Program to Transpose a Matrix
  3. Python Program to Multiply Two Matrices
  4. Python Program to Check Whether a String is Palindrome or Not
  5. Python Program to Remove Punctuations From a String
  6. Python Program to Sort Words in Alphabetic Order
  7. Python Program to Illustrate Different Set Operations
  8. Python Program to Count the Number of Each Vowel
  9. Python Program to Merge Two Dictionaries
  10. Python Program to Access Index of a List Using for Loop
  11. Python Program to Flatten a Nested List
  12. Python Program to Slice Lists
  13. Python Program to Sort a Dictionary by Value
  14. Python Program to Check If a List is Empty
  15. Python Program to Concatenate Two Lists
  16. Python Program to Check if a Key is Already Present in a Dictionary
  17. Python Program to Split a List Into Evenly Sized Chunks
  18. Python Program to Parse a String to a Float or Int
  19. Python Program to Print Colored Text to the Terminal
  20. Python Program to Convert String to Datetime
  21. Python Program to Get the Last Element of the List
  22. Python Program to Get a Substring of a String
  23. Python Program to Randomly Select an Element From the List
  24. Python Program to Check If a String Is a Number (Float)
  25. Python Program to Count the Occurrence of an Item in a List
  26. Python Program to Delete an Element From a Dictionary
  27. Python Program to Create a Long Multiline String
  28. Python Program to Convert Two Lists Into a Dictionary
  29. Python Program to Trim Whitespace From a String
  30. Python Program to Iterate Through Two Lists in Parallel
  31. Python Program to Count the Number of Digits Present In a Number
  32. Python Program to Check If Two Strings are Anagram
  33. Python Program to Capitalize the First Character of a String
  34. Python Program to Compute all the Permutation of the String
  35. Python Program to Count the Number of Occurrence of a Character in String
  36. Python Program to Remove Duplicate Element From a List