Python

Python Practice Exercise

The following Python Practice Exercise comprises basic programming constructs, control flow, and functions in python. Also, the learner can apply the concepts of data structures like lists, tuples, sets, and dictionaries in python applications. Apart from this, it includes the use of object-oriented programming features of python to develop applications. Additionally, the following Python Practice Exercise aims to make you learn how to use exception handling in applications for error handling and gain the knowledge of NumPy and pandas using Python.

Python Practice Exercise

  1. To begin with, demonstrate running instructions in an Interactive interpreter and a Python Script.
  2. Also, write a program to purposefully raise Indentation Error and correct it.
  3. At first, write a program to print the ‘Hello’ message.
  4. Also, write a program add.py that takes 2 numbers as input and prints its sum.
  5. After that, write a program to demonstrate the simple mathematical expression and print the result.
  6. Also, demonstrate the use of different operators in python.
  7. In order to demonstrate the use of operators in python, write a program to perform the basic arithmetic operations in python.
  8. Furthermore, Find the sum of all the primes between two ranges.
  9. For the purpose of understanding strings in python, write a program to perform the string operation.

Data Structures in Python

  1. Apart from that write a Python program to demonstrate the use of List, Tuple, Set, and Dictionary.
  2. Create a program for character counting of a string. Also, store all characters in a dictionary.
  3. Further, demonstrate the use of split and join functions in the string and trace a birthday using the dictionary.
  4. Find the mean, median, mode for the given set of numbers in a list using function.
  5. In order to find duplicates in a list write a function.
  6. Moreover, demonstrate the use of the inbuilt package in python.
  7. Create a Python program to demonstrate the use of a user-defined package and import statement.
  8. For the purpose of understanding exception handling, write an exception handling program in python.
  9. Demonstrate the use of user-defined exceptions.

Classes and Objects

  1. To begin with, write a python program to create Class and Object.
  2. Demonstrate the use of instance variables and methods, and class level attributes.
  3. Further, extend the functionality of Parent classes using Child class
  4. Also, demonstrate the use of methods overriding and data hiding using class.

Text Files

  1. To begin with, write a Python program to read and write a text file.
  2. Write a Python program to copy the contents of a file to another file.
  3. Create a Python program that takes a text file as input and returns the number of words of a given text file.

In-Built Packages

  1. In order to understand the NumPy package, write a program to perform the basic operation on NumPy.
  2. Write a program to perform the basic operation on pandas.
  3. Create a program to show the line, scatter and bar chart.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *