Sunday, June 14, 2026
Home Python Code

Python Code

Python codes with example helps you to grasp the basic concepts you have learnt in the section “Python 3 Fundamentals”. The practice codes covers all the basic concepts such as comments, data types, type casting, string literal, print function, input function, passing arguments, operators, logic and flow control, if else condition, for loop, while loop, functions, scope of a variable, file handling, built-in functions, strings, list, tuple, set, frozenset, dictionary, importing a module, classes and objects.

 

1. Python Code to remove redundant data from a list.

2. Python Code to return the largest and smallest element in a list.

3. Python code to return the elements on odd positions in a list.

4. Python code that takes a number & returns a list of its digits

5. Python code for Primality Test

6. Python code to reverse an integer number

7. Python code to print sum of first 100 Natural Numbers

8. Python code to extract the last two digits of a number

9. Python code to print program name and arguments passed through command line

10. Python code to Calculate sum and average of a list of Numbers

11. Python code to find the largest two numbers in a given list

12. Python Code to separate Even & Odd Elements of a list in 2 Separate lists

13. Python Code to Insert an Element at a Specified Position in a given list

14. Python code to delete an Element from a Specified Position in a given list

15. Python code for Addition and subtraction of two matrices using lists.

16. Python code to Compute the Product of Two Matrices

17. Python code to get transpose matrix of a given Matrix

18. Python code to Find the Frequency of Odd & Even Numbers in the given List

19. Python code to Check if a given String is Palindrome

20. Python Code to Read two Strings & Concatenate the Strings

21. Python code that combines two lists by taking elements alternately

22. Python Code that merges two sorted lists into a new sorted list.

Python code for email spam classification using machine learning

0
In this post, we have explained step-by-step methods regarding the implementation of the Email spam detection and classification using machine learning algorithms in the...

How to print matrix in python using for loop?

0
In this article, we will discuss How to print matrix in python using for loop. This below code demonstrates print of 2D or two-dimensional...

Python initialize 2d array of zeros

0
In this article, we will discuss How to create and initialize a 2D array or two-dimensional list of zeroes in Python. You can also...

Python code to create a 2d list

0
In this article, we will discuss the simplest method to create a 2D or two-dimensional list in Python. You can also implement this code...

Python code to take 2D array input

0
How to take 2D array input in python Python code implementation to take 2D array input.  Code:  column_size = int(input("Enter size of column: ")) row_size = int(input("Enter size...

Python code to get the first digit of a number

0
  There are many techniques to find the first digit of a number using Python language. We will discuss it using typecast, iteration method, list...

Python code to find 2D array size

0
In this article, we will learn how to find 2D array size or 2D list size using Python. We will learn how to find...

Python code to Initialize 2D array

0
In this article, we will learn how to initialize a 2D array (two-dimensional array or list) using Python. We will initialize different sizes of...

Create empty 2d or two dimensional array using Python

0
In this article, we will discuss the simplest method to create a 2D or two-dimensional array using Python. You can also implement this code...

Python code to create empty 2d array

0
In this article, we will discuss the simplest method to create a 2D or two-dimensional array using Python. You can also implement this code...