Python Examples

Basic Programs:

Python program to add two numbers
Maximum of two numbers in Python
Python Program for factorial of a number
Python Program for simple interest
Python Program for compound interest

Python Program to check Armstrong Number
Python Program for Program to find area of a circle
Python program to print all Prime numbers in an Interval
Python program to check whether a number is Prime or not
Python Program for n-th Fibonacci number

Array Programs:

Python Program to find sum of array
Python Program to find largest element in an array
Python Program for array rotation
Python Program for Reversal algorithm for array rotation
Python Program to Split the array and add the first part to the end

List Programs:

Python program to interchange first and last elements in a list
Python program to swap two elements in a list
Python | Ways to find length of list
Python | Ways to check if element exists in list
Different ways to clear a list in Python
Python | Reversing a List
Python program to find sum of elements in list
Python | Multiply all numbers in the list
Python program to find smallest number in a list
Python program to find largest number in a list
Python program to find second largest number in a list
Python program to find N largest elements from a list
Python program to print even numbers in a list
Python program to print odd numbers in a List
Python program to print all even numbers in a range
Python program to print all odd numbers in a range
Python program to print positive numbers in a list
Python program to print negative numbers in a list
Python program to print all positive numbers in a range
Python program to print all negative numbers in a range
Remove multiple elements from a list in Python
Python – Remove empty List from List
Python | Cloning or Copying a list
Python | Count occurrences of an element in a list
Python | Remove empty tuples from a list
Python | Program to print duplicates from a list of integers

Dictionary Programs:

Python – Extract Unique values dictionary values

Python – Convert key-values list to flat dictionary

Python – Insertion at the beginning in OrderedDict
Python | Check order of character in string using OrderedDict( )
Dictionary and counter in Python to find winner of election
Python – Append Dictionary Keys and Values ( In order ) in dictionary
Python | Sort Python Dictionaries by Key or Value
Python – Sort Dictionary key and values List
Handling missing keys in Python dictionaries
Python dictionary with keys having multiple inputs
Print anagrams together in Python using List and Dictionary
Python program to find the sum of all items in a dictionary
Python | Ways to remove a key from dictionary
Ways to sort list of dictionaries by values in Python – Using itemgetter
Ways to sort list of dictionaries by values in Python – Using lambda function
Python | Merging two Dictionaries
K’th Non-repeating Character in Python using List Comprehension and OrderedDict
Check if binary representations of two numbers are anagram
Python Counter to find the size of largest subset of anagram words
Python | Remove all duplicates words from a given sentence
Python Dictionary to find mirror characters in a string
Counting the frequencies in a list using dictionary in Python