[go: up one dir, main page]

0% found this document useful (0 votes)
99 views4 pages

755 - Data Science II Semester

Uploaded by

Deepa P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views4 pages

755 - Data Science II Semester

Uploaded by

Deepa P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

KAKATIYA UNIVERSITY WARANGAL

Under Graduate Courses (Under CBCS AY: 2020-2021 on words)


B.Sc. DATA SCIENCE
I Year: Semester-II

Paper – II: Problem Solving and Python Programming


[4 HPW:: 4 Credits :: 100 Marks (External:80, Internal:20)]

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

Introduction to Computing and Problem Solving: Fundamentals of Computing –


Computing Devices – Identification of Computational Problems – Pseudo Code and
Flowcharts – Instructions – Algorithms – Building Blocks of Algorithms.
Introduction to Python Programming: Python Interpreter and Interactive Mode– Variables
and Identifiers – Arithmetic Operators – Values and Types – Statements, Reading Input, Print
Output, Type Conversions, The type() Function and Is Operator, Dynamic and Strongly
Typed Language.
Control Flow Statements: The if, The if…else, The if…elif…else Decision Control
Statements, Nested if Statement, The while Loop, The for Loop, The continue and break
Statements.

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

Object-Oriented Programming: Classes and Objects, Creating Classes in Python, Creating


Objects in Python, The Constructor Method, Classes with Multiple Objects, Class Attributes
versus Data Attributes, Encapsulation, Inheritance The Polymorphism.
Functional Programming: Lambda. Iterators, Generators, List Comprehensions.

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

Practical- 2: Problem Solving and Python Programming (Lab)


[3 HPW: 1 Credit: 25 Marks]

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

III. Programs to demonstrate the usage of Functions and Recursion


10. Write both recursive and non-recursive functions for the following:
a. To find GCD of two integers
b. To find the factorial of positive integer
c. To print Fibonacci Sequence up to given number ‘n’
d. To convert decimal number to Binary equivalent
11. Program with a function that accepts two arguments: a list and a number ‘n’. It
should display all the numbers in the list that are greater than the given number
‘n’.
12. Program with a function to find how many numbers are divisible by 2, 3,4,5,6 and
7 between 1 to 1000

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.

VI. Programs to demonstrate the usage of Object Oriented Programming


28. Program to implement the inheritance
29. Program to implement the polymorphism

VII. Programs to search and sort the numbers


30. Programs to implement Linear search and Binary search
31. Programs to implement Selection sort, Insertion sort

Page 4 of 4

You might also like