297x Filetype PDF File size 3.18 MB Source: josephscollege.ac.in
B.Sc. (Computer Science)
III - YEAR/ V - SEMESTER
THEORY PAPER – VI (Elective - IC)
Programming in Python
Scheme of Instruction Scheme of Examination
Total durations Hrs : 60 Max. Marks : 100
Hours/Week : 05(3T+2P) Internal Examination :30
Credits : 4 SBT : 10
Instruction Mode: Lecture +practical External Examination :60
Course Code : BS.07.201.14C.T Exam Duration : 3 Hrs
Course Objectives:
To prepare the students with the knowledge of concepts of Programming in Python
Course Outcomes:
On completion of the course the student will
Be able to do basic programming in python
Gain knowledge on CGI and GUI Programming
UNIT - I: Introduction to Programming in Python.
Introduction to Programming in Python:
What Is Python? Features of Python, Python environment set up: Installing Python, Running
Python, Python Documentation, Structure of a Python Program
Basics of Programming in Python:
Input statement, output statement, variables, operators, numbers, Literals, strings, lists and
tuples, dictionaries.
UNIT - II: Conditionals, Loops and Functions.
Conditionals and Loops: if statement, else Statement, elif Statement, while Statement, for
Statement break Statement, continue Statement, pass Statement.
Functions: Built-in Functions, User defined functions: Defining a Function, Calling a Function,
Various Function Arguments.
UNIT - III: Files, Modules and Introduction to Advanced Python.
Files: File Objects, File Built-in Methods, File Built-in Attributes, Standard Files, Command-line
Arguments
Modules: Modules and Files, Namespaces, Importing Modules, Importing Module Attributes,
Module Built-in Functions, Packages.
Introduction to Advanced Python: Classes and objects declaration, Inheritance, Regular
Expressions.
UNIT - IV: Python GUI & CGI Programming and Python database connectivity.
Python GUI Programming (Tkinter): Tkinter Programming example, Tkinter widges, standard
attributes, geometry management
Python CGI Programming: CGI Architecture, First CGI Program, HTTP Header, CGI
Environment Variables, GET and POST Methods, Simple FORM Example: Using GET
Method, Passing Information Using POST Method
Python database connectivity: Establishing connection, insert, retrieve, delete, and rollback and
commit operations.
References:
1.Core Python Programming Wesley J. Chun Publisher: Prentice Hall PTR First Edition
2.T. Budd, Exploring Python, TMH, 1st Ed, 2011
3.Python Tutorial/Documentation www.python.or 2010
4.Allen Downey, Jeffrey Elkner, Chris Meyers , How to think like a computer scientist :
learning with Python , Freely available online.2015
5.Web Resource: http://interactivepython.org/courselib/static/pythonds
B.Sc. (Computer Science)
III – YEAR / V - SEMESTER
PRACTICAL PAPER – VI (Elective - IC)
Programming in Python Lab Question Bank
Subject Code: BS.07.201.14C.P
1. Write a Python program to get the largest number from a list.
2. a) Write a Python script to concatenate two dictionaries to create a new one.
b) Write a Python program to sort a dictionary by key.
3. a) Write a Python program to create a tuple with different data types.
b) Write a Python program to find the repeated items of a tuple.
4. Write a Python program that accepts a word from the user and reverse it.
5. Write a phython program to demonstrate functions.
6. Write a phython program to demonstrate classes.
7. Write a program to perform file operations.
8. Write a Python program to check that a string contains only a certain set of characters
(in this case a-z, A-Z and 0-9)
9. Develop following GUI components:
a) create a window
b) create a frame
c) create canvas
d) create message widget
e) scale
10. Develop following GUI components:
a) To create Entry
b) Radio button
c) checkbox
d) menu
e) Button
f) List box
11. Develop a form and use GET Method,
12. Develop a form and Pass Information Using POST Method.
13. Write a python program to insert data into table.
14. Write a python program to retrieve data from data base
15. Write a python program to perform Rollback and commit operations
UNIT - I
Introduction to PYTHON:
(introduced by Guido Van Rossum in early 80s)
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to
be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has
fewer syntactical constructions than other languages.
Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to
compile your program before executing it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter
directly to write your programs.
Python is Object-Oriented − Python supports Object-Oriented style or technique of programming
that encapsulates code within objects.
Python is a Beginner's Language − Python is a great language for the beginner-level programmers
and supports the development of a wide range of applications from simple text processing to WWW
browsers to games.
Python Features
Python's features include −
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax. This
allows the student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
Easy-to-maintain − Python's source code is fairly easy-to-maintain.
A broad standard library − Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows interactive testing and
debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same interface on all
platforms.
Extendable − You can add low-level modules to the Python interpreter. These modules enable
programmers to add to or customize their tools to be more efficient.
Databases − Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported to many
system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window
system of Unix.
Scalable − Python provides a better structure and support for large programs than shell scripting.
It supports functional and structured programming methods as well as OOP.
It can be used as a scripting language or can be compiled to byte-code for building large applications.
It provides very high-level dynamic data types and supports dynamic type checking.
IT supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Python - Environment Setup
Python is available on a wide variety of platforms including Linux and Mac OS X.
Getting Python
The most up-to-date and current source code, binaries, documentation, news, etc., is available on the official
website of Python https://www.python.org/
You can download Python documentation from https://www.python.org/doc/. The documentation is
available in HTML, PDF, and PostScript formats.
no reviews yet
Please Login to review.