755 - Data Science II Semester
755 - Data Science II Semester
Objectives
The main objective is to teach Computational thinking using Python.
To know the basics of Programming
To convert an algorithm into a Python program
To construct Python programs with control structures.
To structure a Python Program as a set of functions
To use Python data structures-lists, tuples, dictionaries.
To do input/output with files in Python.
To construct Python programs as a set of objects.
Outcomes:
On completion of the course, students will be able to:
1. Develop algorithmic solutions to simple computational problems.
2. Develop and execute simple Python programs.
3. Develop simple Python programs for solving problems.
4. Structure a Python program into functions.
5. Represent compound data using Python lists, tuples, and dictionaries.
6. Read and write data from/to files in Python Programs
Unit-I
Unit-II
Functions: Built-In Functions, Commonly Used Modules, Function Definition and Calling
the Function, The return Statement and void Function, Scope and Lifetime of Variables,
Default Parameters, Keyword Arguments, *args and **kwargs, Command Line Arguments.
Strings: Creating and Storing Strings, Basic String Operations, Accessing Characters in
String by Index Number, String Slicing and Joining, String Methods, Formatting Strings.
Page 1 of 4
Unit-III
Lists: list operations, list slices, list methods, list loop, mutability, aliasing, cloning lists, list
Parameters; Tuples: tuple assignment, tuple as return value; Dictionaries: operations and
methods; advanced list processing - list comprehension; Illustrative programs: selection sort,
insertion sort, mergesort, histogram.
Files and exception: text files, reading and writing files, format operator; command line
arguments, errors and exceptions, handling exceptions, modules, packages; Illustrative
programs: word count, copy file.
Unit-IV
References:
1. Introduction to Python Programming. Gowrishankar S, Veena A. CRC Press, Taylor
& Francis Group, 2019
2. Allen B. Downey, ``Think Python: How to Think Like a Computer Scientist’’, 2nd
edition, Updated for Python 3, Shroff/O’Reilly Publishers, 2016
(http://greenteapress.com/wp/think- python/)
Suggested Reading:
1. Learning To Program With Python. Richard L. Halterman. Copyright © 2011
2. Python for Everybody, Exploring Data Using Python 3. Dr. Charles R. Severance.
2016
Page 2 of 4
KAKATIYA UNIVERSITY WARANGAL
Under Graduate Courses (Under CBCS AY: 2020-2021 on words)
B.Sc. DATA SCIENCE
I Year: Semester-II
Objective
The main objective of this laboratory is to put into practice computational thinking. The
students will be expected to write, compile, run and debug Python programs to demonstrate
the usage of
variables, conditionals and control structures
functions (both recursive and iterative)
basic data types as well as compound data structures such as strings, lists, sets, tuples,
dictionaries
object-oriented programming
Exercises
I. Programs to demonstrate the usage of operators and conditional statements
1. Write a program that takes two integers as command line arguments and prints the
sum of two integers.
2. Program to display the information:
Your name, Full Address, Mobile Number, College Name, Course Subjects
3. Program to find the largest number among ‘n’ given numbers.
4. Program that reads the URL of a website as input and displays contents of a
webpage.
II. Programs to demonstrate usage of control structures
5. Program to find the sum of all prime numbers between 1 and 1000.
6. Program that reads set of integers and displays first and second largest numbers.
7. Program to print the sum of first ‘n’ natural numbers.
8. Program to find the product of two matrices.
9. Program to find the roots of a quadratic equation
Page 3 of 4
IV. Programs to demonstrate the usage of String functions
13. Program that accept a string as an argument and return the number of vowels and
consonants the string contains.
14. Program that accepts two strings S1, S2, and finds whether they are equal are not.
15. Program to count the number of occurrences of characters in a given string.
16. Program to find whether a given string is palindrome or not
V. Programs to demonstrate the usage of lists, sets, dictionaries, tuples and files.
17. Program with a function that takes two lists L1 and L2 containing integer numbers
as parameters. The return value is a single list containing the pair wise sums of the
numbers in L1 and L2.
18. Program to read the lists of numbers as L1, print the lists in reverse order without
Using reverse function.
22. Write a program that combines lists L1 and L2 into a dictionary.
19. Program to find mean, median, mode for the given set of numbers in a list.
20. Program to find all duplicates in the list.
21. Program to o find all the unique elements of a list.
22. Program to find max and min of a given tuple of integers.
23. Program to find union, intersection, difference, symmetric difference of given two
sets.
24. Program to display a list of all unique words in a text file
25. Program to read the content of a text file and display it on the screen line wise with
a line number followed by a colon
26. Program to analyse the two text files using set operations
27. Write a program to print each line of a file in reverse order.
Page 4 of 4