PYTHON PROGRAMMING NOTES

Unformatted text preview:

PYTHON PROGRAMMING III YEAR II SEM MRCET PYTHON PROGRAMMING R17A0554 LECTURE NOTES B TECH III YEAR II SEM R17 2019 20 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING MALLA REDDY COLLEGE OF ENGINEERING TECHNOLOGY Autonomous Institution UGC Govt of India Recognized under 2 f and 12 B of UGC ACT 1956 Affiliated to JNTUH Hyderabad Approved by AICTE Accredited by NBA NAAC A Grade ISO 9001 2015 Maisammaguda Dhulapally Post Via Hakimpet Secunderabad 500100 Telangana State India Certified PYTHON PROGRAMMING MRCET III YEAR II SEM SYLLABUS MALLA REDDY COLLEGE OF ENGINEERING AND TECHNOLOGY III Year B Tech CSE II SEM L 3 T P D C 3 OPEN ELECTIVE III R17A0554 PYTHON PROGRAMMING OBJECTIVES To read and write simple Python programs To develop Python programs with conditionals and loops To define Python functions and call them To use Python data structures lists tuples dictionaries To do input output with files in Python UNIT I INTRODUCTION DATA EXPRESSIONS STATEMENTS Introduction to Python and installation data types Int float Boolean string and list variables expressions statements precedence of operators comments modules functions function and its use flow of execution parameters and arguments UNIT II CONTROL FLOW LOOPS Conditionals Boolean values and operators conditional if alternative if else chained conditional if elif else Iteration while for break continue UNIT III FUNCTIONS ARRAYS Fruitful functions return values parameters local and global scope function composition recursion Strings string slices immutability string functions and methods string module Python arrays Access the Elements of an Array array methods UNIT IV LISTS TUPLES DICTIONARIES Lists list operations list slices list methods list loop mutability aliasing cloning lists list parameters list comprehension Tuples tuple assignment tuple as return value tuple comprehension Dictionaries operations and methods comprehension UNIT V FILES EXCEPTIONS MODULES PACKAGES Files and exception text files reading and writing files command line arguments errors and exceptions handling exceptions modules datetime time OS calendar math module Explore packages PYTHON PROGRAMMING III YEAR II SEM MRCET OUTCOMES Upon completion of the course students will be able to Read write execute by hand simple Python programs Structure simple Python programs for solving problems Decompose a Python program into functions Represent compound data using Python lists tuples dictionaries Read and write data from to files in Python Programs TEXT BOOKS 1 Allen B Downey Think Python How to Think Like a Computer Scientist 2nd edition Updated for Python 3 Shroff O Reilly Publishers 2016 2 R Nageswara Rao Core Python Programming dreamtech 3 Python Programming A Modern Approach Vamsi Kurama Pearson REFERENCE BOOKS 1 Core Python Programming W Chun Pearson 2 Introduction to Python Kenneth A Lambert Cengage 3 Learning Python Mark Lutz Orielly PYTHON PROGRAMMING III YEAR II SEM MRCET UNIT TOPIC PAGE NO I II INDEX INTRODUCTION DATA EXPRESSIONS STATEMENTS Introduction to Python and installation data types Int float Boolean string List variables expressions statements comments modules precedence of operators functions function and its use flow of execution parameters and arguments CONTROL FLOW LOOPS Conditionals Boolean values and operators conditional if alternative if else chained conditional if elif else Iteration while for break continue FUNCTIONS ARRAYS Fruitful functions return values parameters local and global scope function composition Strings string slices immutability string functions and methods string module Python arrays Array methods Access the Elements of an Array III recursion 1 1 6 7 8 8 10 11 13 16 17 18 19 20 21 26 35 35 36 37 39 41 55 55 57 59 62 63 64 66 67 72 73 75 76 PYTHON PROGRAMMING III YEAR II SEM LISTS TUPLES DICTIONARIES MRCET IV V Lists list operations list slices list methods list loop mutability aliasing cloning lists list parameters list comprehension Tuples tuple assignment tuple as return value tuple comprehension Dictionaries operations and methods comprehension FILES EXCEPTIONS MODULES PACKAGES Files and exception text files reading and writing files command line arguments errors and exceptions handling exceptions modules datetime time OS calendar math module Explore packages 78 78 79 80 81 83 85 87 88 89 90 91 94 95 96 97 97 102 103 103 104 109 112 114 121 134 PYTHON PROGRAMMING III YEAR II SEM MRCET UNIT I INTRODUCTION DATA EXPRESSIONS STATEMENTS Introduction to Python and installation data types Int float Boolean string and list variables expressions statements precedence of operators comments modules functions function and its use flow of execution parameters and arguments Introduction to Python and installation Python is a widely used general purpose high level programming language It was initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation It was mainly developed for emphasis on code readability and its syntax allows programmers to express concepts in fewer lines of code Python is a programming language that lets you work quickly and integrate systems more efficiently There are two major Python versions Python 2 and Python 3 On 16 October 2000 Python 2 0 was released with many new features On 3rd December 2008 Python 3 0 was released with more testing and includes new features interpreters Beginning with Python programming 1 Finding an Interpreter Before we start Python programming we need to have an interpreter to interpret and run our programs There are certain online like https ide geeksforgeeks org http ideone com or http codepad org that can be used to start Python without installing an interpreter Windows There are many interpreters available freely to run Python scripts like IDLE Integrated Development Environment which is installed when you install the python software from http python org downloads 2 Writing first program Script Begins Statement1 1 III YEAR II SEM MRCET PYTHON PROGRAMMING Statement2 Statement3 Script Ends Differences between scripting language and programming language Why to use Python The following are the primary factors to use python in day to day life 1 Python is object oriented Structure supports such concepts as polymorphism operation overloading and multiple inheritance 2 Indentation Indentation is one of the greatest feature in python 2 PYTHON PROGRAMMING III YEAR II SEM MRCET 3 It s free open source 4 It s Powerful Downloading python and installing python is


View Full Document

PYTHON PROGRAMMING NOTES

Download PYTHON PROGRAMMING NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view PYTHON PROGRAMMING NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view PYTHON PROGRAMMING NOTES and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?