Python Programs

  • Last Updated : 28 Sep, 2023

 

The following Python section contains a wide collection of Python programming examples. These code examples cover a wide range of basic concepts in the Python language including List, strings, dictionary, tuple, sets, and many more. Each program example contains multiple approaches to solve the problem.

Python Programming Examples

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





 
 

Basic Programs:

Array Programs:

List Programs:

Matrix Programs:

String Programs:

  1. Python program to check if a string is palindrome or not
  2. Python program to check whether the string is Symmetrical or Palindrome
  3. Reverse words in a given String in Python
  4. Ways to remove i’th character from string in Python
  5. Python | Check if a Substring is Present in a Given String
  6. Python – Words Frequency in String Shorthands
  7. Python – Convert Snake case to Pascal case
  8. Find length of a string in python (4 ways)
  9. Python program to print even length words in a string
  10. Python program to accept the strings which contains all vowels
  11. Python | Count the Number of matching characters in a pair of string
  12. Remove all duplicates from a given string in Python
  13. Python – Least Frequent Character in String
  14. Python | Maximum frequency character in String
  15. Python | Program to check if a string contains any special character
  16. Generating random strings until a given string is generated
  17. Find words which are greater than given length k
  18. Python program for removing i-th character from a string
  19. Python program to split and join a string
  20. Python | Check if a given string is binary string or not
  21. Python program to find uncommon words from two Strings
  22. Python – Replace duplicate Occurrence in String
  23. Python – Replace multiple words with K
  24. Python | Permutation of a given string using inbuilt function
  25. Python | Check for URL in a String
  26. Execute a String of Code in Python
  27. String slicing in Python to rotate a string
  28. String slicing in Python to check if a string can become empty by recursive deletion
  29. Python Counter| Find all duplicate characters in string
  30. Python – Replace all occurrences of a substring in a string
  31. More >>

Dictionary Programs:

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

Tuple Programs:

Searching and Sorting Programs:

Pattern Printing Programs:

Date-Time Programs:

Python Regex Programs:

  1. Python Program to Check if String Contain Only Defined Characters using Regex
  2. Python program to Count Uppercase, Lowercase, special character and numeric values using Regex
  3. Python Program to find the most occurring number in a string using Regex
  4. Python Regex to extract maximum numeric value from a string
  5. Python Program to put spaces between words starting with capital letters using Regex
  6. Python – Check whether a string starts and ends with the same character or not
  7. Python regex to find sequences of one upper case letter followed by lower case letters
  8. Python Program to Remove duplicate words from Sentence
  9. Python | Remove all characters except letters and numbers
  10. Python Regex | Program to accept string ending with alphanumeric character
  11. Python Regex – Program to accept string starting with vowel
  12. Python Program to check if a string starts with a substring using regex
  13. Python Program to Check if an URL is valid or not using Regular Expression
  14. Parsing and Processing URL using Python – Regex
  15. Python Program to validate an IP address using ReGex
  16. Python Program to Check if email address valid or not
  17. Python program to find files having a particular extension using RegEx
  18. Python program to extract IP address from file
  19. Python program to check the validity of a Password
  20. Categorize Password as Strong or Weak using Regex in Python

Python File Handling Programs:

  1. Python program to read file word by word
  2. Python program to read character by character from a file
  3. Python – Get number of characters, words, spaces and lines in a file
  4. Python program to Count the Number of occurrences of a key-value pair in a text file
  5. Python | Finding ‘n’ Character Words in a Text File
  6. Python Program to obtain the line number in which given word is present
  7. Count number of lines in a text file in Python
  8. Python Program to remove lines starting with any prefix
  9. Python Program to Eliminate repeated lines from a file
  10. Python Program to read List of Dictionaries from File
  11. Python – Append content of one text file to another
  12. Python program to copy odd lines of one file to other
  13. Python Program to merge two files into a third file
  14. Python program to Reverse a single line of a text file
  15. Python program to reverse the content of a file and store it in another file
  16. Python Program to Reverse the Content of a File using Stack

More Python Programs:

If you like GeeksforGeeks and would like to contribute, you can also write an article on https://write.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.