Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Introduction to python

Rating
-
Sold
-
Pages
37
Uploaded on
08-04-2025
Written in
2024/2025

This PDF contains comprehensive notes covering the fundamental concepts of Python programming. It is designed for beginners who are new to coding or looking to build a strong foundation in Python. The notes are organized in a clear and structured format, making them ideal for self-study, classroom learning, or quick reference.

Show more Read less
Institution
Course

Content preview

Python Application Programming (15CS664) Module I


MODULE I

1.1 WHY SHOULD YOU LEARN TO WRITE PROGRAMS
Creativity and motivation, Computer hardware architecture, Understanding programming, Words and
sentences, Conversing with Python, Terminology: interpreter and compiler, Writing a program . What is
a program, The building blocks of programs, What could possibly go wrong


1.2 VARIABLES, EXPRESSIONS, AND STATEMENTS
Values and types, Variables, Variable names and keywords, Statements, Operators and operands,
Expressions ,Order of operations, Modulus Operator, String, Asking the user for input, Comments,
Choosing mnemonic variable names, Debugging


1.3 CONDITIONAL EXECUTION

Boolean expressions, Logical operators, Conditional execution, Alternative execution , Chained
conditional Nested conditionals, Catching exceptions using try and except ,Short-circuit evaluation of
logical expressions, Debugging

1.4 FUNCTIONS

Function calls, Built-in functions,Type conversion functions, Random numbers, Math functions, Adding
new functions , Definitions and uses, Flow of execution, Parameters and arguments , Fruitful functions
and void functions , Why functions?




Mamatha A, Asst Prof, Dept of CSE, SVIT Page 1

,Python Application Programming (15CS664) Module I


MODULE I

1.1 WHY SHOULD YOU LEARN TO WRITE PROGRAMS
 Programs are generally written to solve the real-time arithmetic/logical problems.
 Nowadays, computational devices like personal computer, laptop, and cell phones are embedded
with operating system, memory and processing unit. Using such devices one can write a program
in the language (which a computer can understand) of one‟s choice to solve various types of
problems.
 Humans are tend get bored by doing computational tasks multiple times. Hence, the computer can
act as a personal assistant for people for doing their job!! To make a computer to solve the required
problem, one has to feed the proper program to it. Hence, one should know how to write a
program!!
 There are many programming languages that suit several situations. The programmer must be able
to choose the suitable programming language for solving the required problem based on the factors
like computational ability of the device, data structures that are supported in the language,
complexity involved in implementing the algorithm in that language etc.

 Creativity and Motivation
 When a person starts programming, he himself will be both the programmer and the end- user.
Because, he will be learning to solve the problems.
 But, later, he may become a proficient programmer. A programmer should have logical thinking
ability to solve a given problem. He/she should be creative in analyzing the given problems,
finding the possible solutions, optimizing the resources available and delivering the best possible
results to the end-user.
 Motivation behind programming may be a job-requirement and such other prospects. But, the
programmer should follow certain ethics in delivering the best possible output to his/her clients.
 The responsibilities of a programmer includes developing a feasible, user-friendly software with
very less or no hassles.
 The user is expected to have only the abstract knowledge about the working of software, but not
the implementation details. Hence, the programmer should strive hard towards developing most
effective software.

 Computer Hardware Architecture
 To understand the art programming, it is better to know the basic architecture of computer
hardware.
 The computer system involves some of the important parts as shown in Figure
These parts are as explained below:
 Central Processing Unit (CPU): It performs basic arithmetic, logical, control and I/O
Mamatha A, Asst Prof, Dept of CSE, SVIT Page 2

,Python Application Programming (15CS664) Module I


operations specified by the program instructions. CPU will perform the given tasks with a
tremendous speed. Hence, the good programmer has to keep the CPU busy by providing
enough tasks to it.
 Main Memory: It is the storage area to which the CPU has a direct access. Usually, the
programs stored in the secondary storage are brought into main memory before the execution.
The processor (CPU) will pick a job from the main memory and performs the tasks. Usually,
information stored in the main memory will be vanished when the computer is turned-off.


What
Next?
Software

Input and Output Central
Devices Processing Unit




Main Secondary
Memory Memory


Figure 1.1 Computer Hardware Architecture

 Secondary Memory: The secondary memory is the permanent storage of computer. Usually,
the size of secondary memory will be considerably larger than that of main memory. Hard disk,
USB drive etc can be considered as secondary memory storage.
 I/O Devices: These are the medium of communication between the user and the computer.
Keyboard, mouse, monitor, printer etc. are the examples of I/O devices.
 Network Connection: Nowadays, most of the computers are connected to network and hence
they can communicate with other computers in a network. Retrieving the information from
other computers via network will be slower compared to accessing the secondary memory.
Moreover, network is not reliable always due to problem in connection.
 The programmer has to use above resources sensibly to solve the problem.
 Usually, a programmer will be communicating with CPU by telling it „what to do next‟. The usage
of main memory, secondary memory, I/O devices also can be controlled by the programmer.
 To communicate with the CPU for solving a specific problem, one has to write a set of instructions.
Such a set of instructions is called as a program.

 Understanding Programming
 A programmer must have skills to look at the data/information available about a problem, analyze
it and then to build a program to solve the problem. The skills to be possessed by a good
programmer includes –
Mamatha A, Asst Prof, Dept of CSE, SVIT Page 3

, Python Application Programming (15CS664) Module I


 Thorough knowledge of programming language: One needs to know the vocabulary and
grammar (technically known as syntax) of the programming language. This will help in
constructing proper instructions in the program.
 Skill of implementing an idea: A programmer should be like a „story teller‟. That is, he must
be capable of conveying something effectively. He/she must be able to solve the problem by
designing suitable algorithm and implementing it. And, the program must provide appropriate
output as expected.

 Thus, the art of programming requires the knowledge about the problem‟s requirement and the
strength/weakness of the programming language chosen for the implementation. It is always
advisable to choose appropriate programming language that can cater the complexity of the problem
to be solved.
 Words and Sentences
 Every programming language has its own constructs to form syntax of the language.
 Basic constructs of a programming language includes set of characters and keywords that it
supports.
 The keywords have special meaning in any language and they are intended for doing specific task.
Python has a finite set of keywords as given in Table below.

Table : Keywords in Python
and as assert Break class continue
def del elif Else except False
finally for from Global if import
In is lambda None nonlocal not
Or pass raise Return True try
while with Yield

 A programmer may use variables to store the values in a program.
 Unlike many other programming languages, a variable in Python need not be declared before its
use.


 Python Editors and Installing Python
 Before getting into details of the programming language Python, it is better to learn how to install
the software.
 Python is freely downloadable from the internet. There are multiple IDEs (Integrated Development
Environment) available for working with Python. Some of them are PyCharm, LiClipse, IDLE etc.
 When you install Python, the IDLE editor will be available automatically. Apart from all these
editors, Python program can be run on command prompt also.
 One has to install suitable IDE depending on their need and the Operating System they are using.

Mamatha A, Asst Prof, Dept of CSE, SVIT Page 4

Written for

Course

Document information

Uploaded on
April 8, 2025
Number of pages
37
Written in
2024/2025
Type
Class notes
Professor(s)
Bayregowda
Contains
All classes

Subjects

$6.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sanathmogaveer13

Also available in package deal

Get to know the seller

Seller avatar
sanathmogaveer13 VTU
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions