Python Programming Examples

 

Following Python section contains a wide collection of Python programming examples. The examples are categorized based on the topics including List, strings, dictionary, tuple, sets and many more. Each program example contains multiple approaches to solve the problem.

Recent Articles on Python !
Python Output & Multiple Choice Questions
 
Topics :


Basic Programs:

Array Programs:

List Programs:

  1. Python program to interchange first and last elements in a list
  2. Python program to swap two elements in a list
  3. Python program to remove Nth occurrence of the given word
  4. Python | Ways to find length of list
  5. Python | Ways to check if element exists in list
  6. Different ways to clear a list in Python
  7. Python | Reversing a List
  8. Python | Cloning or Copying a list
  9. Python | Count occurrences of an element in a list
  10. Python program to find sum of elements in list
  11. Python | Multiply all numbers in the list
  12. Python program to find smallest number in a list
  13. Python program to find largest number in a list
  14. Python program to find second largest number in a list
  15. Python program to find N largest elements from a list
  16. Python program to print even numbers in a list
  17. Python program to print odd numbers in a List
  18. Python program to print all even numbers in a range
  19. Python program to print all odd numbers in a range
  20. Python program to count Even and Odd numbers in a List
  21. Python program to print positive numbers in a list
  22. Python program to print negative numbers in a list
  23. Python program to print all positive numbers in a range
  24. Python program to print all negative numbers in a range
  25. Python program to count positive and negative numbers in a list
  26. Remove multiple elements from a list in Python
  27. Python | Remove empty tuples from a list
  28. Python | Program to print duplicates from a list of integers
  29. Python program to find Cumulative sum of a list
  30. Break a list into chunks of size N in Python
  31. Python | Sort the values of first list using second list
  32. More >>

String Programs:

Dictionary Programs:

  1. Python | Sort Python Dictionaries by Key or Value
  2. Handling missing keys in Python dictionaries
  3. Python dictionary with keys having multiple inputs
  4. Python program to find the sum of all items in a dictionary
  5. Python | Ways to remove a key from dictionary
  6. Ways to sort list of dictionaries by values in Python – Using itemgetter
  7. Ways to sort list of dictionaries by values in Python – Using lambda function
  8. Python | Merging two Dictionaries
  9. Program to create grade calculator in Python
  10. Python | Check order of character in string using OrderedDict( )
  11. Python | Find common elements in three sorted arrays by dictionary intersection
  12. Dictionary and counter in Python to find winner of election
  13. Find all duplicate characters in string
  14. Print anagrams together in Python using List and Dictionary
  15. K’th Non-repeating Character in Python using List Comprehension and OrderedDict
  16. Check if binary representations of two numbers are anagram
  17. Python Counter to find the size of largest subset of anagram words
  18. Python | Remove all duplicates words from a given sentence
  19. Python Dictionary to find mirror characters in a string
  20. Counting the frequencies in a list using dictionary in Python
  21. Python | Convert a list of Tuples into Dictionary
  22. Python counter and dictionary intersection example (Make a string using deletion and rearrangement)
  23. Python dictionary, set and counter to check if frequencies can become same
  24. Scraping And Finding Ordered Words In A Dictionary using Python
  25. Possible Words using given characters in Python
  26. More >>

Tuple Programs:

Searching and Sorting Programs:

Pattern Printing Programs:

Date-Time Programs:

More Python Programs:

  1. Python Program to Reverse a linked list
  2. Python Program for Find largest prime factor of a number
  3. Python Program for Efficient program to print all prime factors of a given number
  4. Python Program for Product of unique prime factors of a number
  5. Python Program for Find sum of odd factors of a number
  6. Python Program for Coin Change
  7. Python Program for Tower of Hanoi
  8. Python Program for Sieve of Eratosthenes
  9. Python Program to Check if binary representation is palindrome
  10. Python Program for Basic Euclidean algorithms
  11. Python Program for Extended Euclidean algorithms
  12. Python Program for Number of elements with odd factors in given range
  13. Python Program for Common Divisors of Two Numbers
  14. Python Program for Maximum height when coins are arranged in a triangle
  15. Python Program for GCD of more than two (or array) numbers
  16. Python Program for Check if count of divisors is even or odd
  17. Python Program for Find minimum sum of factors of number
  18. Python Program for Difference between sums of odd and even digits
  19. Python Program for Program to Print Matrix in Z form
  20. Python Program for Largest K digit number divisible by X
  21. Python Program for Smallest K digit number divisible by X
  22. Python Program for Print Number series without using any loop
  23. Python Program for Number of stopping station problem
  24. Python Program for Program to calculate area of a Tetrahedron
  25. Python Program for focal length of a spherical mirror
  26. Python Program for Find the perimeter of a cylinder
  27. Check if a triangle of positive area is possible with the given angles
  28. Python Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane
  29. Python Program for Finding the vertex, focus and directrix of a parabola
  30. Python program to find the most occurring character and its count
  31. Python Program for Find sum of even factors of a number
  32. Python Program for Check if all digits of a number divide it
  33. Python program to convert float decimal to Octal number
  34. Python program to convert floating to binary
  35. Check whether a number has consecutive 0’s in the given base or not
  36. Python Program for Number of solutions to Modular Equations
  37. Python Program for Triangular Matchstick Number
  38. Python Program for Legendre\’s Conjecture
  39. Python program to check if a string contains all unique characters
  40. Python program to copy odd lines of one file to other

If you like GeeksforGeeks and would like to contribute, you can also write an article on https://contribute.geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.



My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.