1052234440
PYTHON PROGRAMMING
Practicum
U nit I INTRODUCTION TO PYTHON
Installing and running Python in interpreter and Interactive mode, Basic Datatypes
in Python: int, float, string. Storing Values in Variables, Basic functions in Python:
input (), print (), str (), int (), float (). Decision Making – Simple if, if…else and if …
elif statement; Control Statement: while, break, continue, for loop, range ().
4
Ex No 1: Write a python program to read three numbers and print the greatest of
three numbers.
Ex No 2: Write a python program to find the sum of N number using range ()
function in for loop.
12
Unit II STRING, LIST, TUPLE, DICTIONARY
Sequence Data types. Operations on sequence data types: Indexing and slicing,
concatenation, and replication, in and not in operators to access elements. List:
Creation, mutable property, In build methods of List: index (), append (), insert (),
sort (), reverse (). Tuple: immutable property, converting types using tuple (), list
(). Dictionary Data type: Creation, keys (), values () and items () methods.
4
Ex No 3: Write a python program to demonstrate the string slicing, concatenation,
replication and len() method.
Ex No 4: Write a python program to create a tuple and convert into a list and print
the list in sorted order.
Ex No 5: Write a python program to create a dictionary and check whether a key
or value exist in the dictionary.
16
Unit III NumPy
Install and import NumPy module, Creation of one dimensional, 2D-dimensional
NumPy array using array (), Slicing, indexing, NumPy methods: shape (),
reshape(), concatenate (), where (). Arithmetic operations in NumPy, Aggregation
functions in NumPy.
4
Ex No 6: Write a python program to create one dimensional array and convert into
a 2D-dimensional array using reshape(), print the first two columns alone using
slicing.
Ex No 7: Write a python program to create two-dimensional array and search for
16
DIRECTORATE OF TECHNICAL EDUCATION, CHENNAI – 600 025
2023 REGULATION
77
an element using where () function.
Ex No 8: Write a python program to create a 2D-dimensional array and
demonstrate aggregation functions sum (), min () and max () in the row and
column wise.
UNIT IV FILE HANDLING
Text file handling: file opening mode, reading from a file: read(), readline(),
readlines() and writing into a file: write(), writeline(). Pandas package: install and
import pandas, read and write a csv file, pandas methods: head(), describe().
3
Ex No 9: Write a python program to read a text file and write the content in
another file.
Ex No 10: Write a python program to read a csv file using pandas and print the
content.
Reviews
There are no reviews yet.