Sunday, June 14, 2026

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 to generate random phone numbers

0
Python code to generate random phone numbers   Python code implementation to generate random phone numbers using the random function Code:  import random def random_phone_num_generator(): first...

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

0
Python Code that merges two sorted lists into a new sorted list. # , → . Python code implementation without user-defined functions & classes Code:  #Python Code that...

Python code that combines two lists by taking elements alternately

0
Python code that combines two lists by taking elements alternately. # e.g. , → . Python code implementation without user-defined functions & classes Code:  #Python code that...

Python code to Check if a given String is Palindrome

0
Python code to check if a given String is Palindrome   Python code implementation without user-defined functions & classes Code:  #Python code to Check if a given String...

Python code to Find the Frequency of Odd & Even Numbers...

0
Python code to Find the Frequency of Odd & Even Numbers in the given Lists.   Python code implementation without user-defined functions & classes Code:  #Python code to...

Python code to get transpose matrix of a given Matrix

0
Python code to get transpose matrix of a given Matrix.   Python code implementation without user-defined functions & classes Code:  #Python code to get transpose matrix of a...

Python code to Compute the Product of Two Matrices

0
Python code to Compute the Product of Two Matrices.   Python code implementation without user-defined functions & classes Code:  #Python code to Compute the Product of Two Matrices a...

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

0
Python code for Addition and subtraction of two matrices using lists.   Python code implementation without user-defined functions & classes Code:  #Python code for Addition and subtraction of...

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

0
Python code to delete an Element from a Specified Position in a given list.   Python code implementation without user-defined functions & classes Code:  #Python code to delete...

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

0
Python Code to Insert an Element at a Specified Position in a given list.   Python code implementation without user-defined functions & classes Code:  #Python Code to Insert...