Home » Basic Examples

Basic Examples

by maxguy71
Basic Examples

This covers basic programs and simple python programming examples.

Number Examples

Check for a Prime Number program in python
Convert Decimal to Binary, Octal and Hexadecimal using python
Check if a Number is Odd or Even in python
Check for a palindrome in python
Find Factorial of a Number in Python
Check is a number is a Perfect Number in python

Date Examples

Check if its a Leap Year in Python
Get difference between two dates in months using python
How to find the number of days between two given dates in python
Find Yesterday’s, Today’s and Tomorrow’s date in Python
How to add or subtract days to a date in Python

List Examples

This programs section covers programs to work with lists

Ways to find length of list in python
Find The Largest and Smallest Number in a List in python
How To Add Two Lists in python
How to Count Even and Odd Numbers in a List using python
Check If a List is Empty in python
Sort a List in Ascending Order in Python
Sort a List in Descending Order in Python
Get a Random element from a List in Python

Tuple Examples

Creating a Tuple in Python
Find Largest and Smallest Item in a Tuple in python
Check Item exists in a Tuple in Python
Concatenating two Tuples in python
Find Sum of Tuple Items using Python
Slice a Tuple in python

String Examples

This programs section covers programs to work with strings

Count Vowels and Consonants in a String Correctly using python
Concatenate Strings in python
Convert String to Lowercase or Uppercase in python
Count Character Frequency of a String using python
Check If Two Different Strings are Anagrams using python
Capitalize the First Letter of Each Word of a String in Python
Replace Characters in a String in python
Check if a string is a palindrome in python
How to Remove Punctuation marks from a String
Count total number of alphabets, digits and special characters using python

File Operations

This programs section covers programs to work with files

Read a file word by word in python
How to Check the File Size in python
How to check if a file exists in python
Find All Files with a certain Extension Present Inside a Directory using Python
How to Get the Line Count of a File using python
Reading a CSV File using the CSV Module in Python
List all Files with a Certain Extension using Python

Sorting examples

Bubble Sort in python
selection sort in python
Quicksort example in python
Merge Sort example in python
Insertion Sort in python
Pigeonhole Sort in python

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More