Programming using Python
Amey Karkare
Dept. of CSE
IIT Kanpur
For any queries reach out to rahulgr@iitk.ac.in or rahulgarg@robustresults.com
or whatsapp 9910043510
1
Welcome Python Programming E&ICT IIT Kanpur
About me
Amey Karkare
Dept. of CSE
IIT Kanpur
http://www.cse.iitk.ac.in/~karkare
2
Welcome Programming E&ICT IIT Kanpur
Acknowledgements
➢ The images/contents are used for
teaching purpose and for fun. The
copyright remains with the original
creator. If you suspect a copyright
violation, bring it to my notice and I
will remove that image/content.
3
Welcome Python Programming E&ICT IIT Kanpur
The Course
➢The course teaches you how to solve
problems using the computer.
➢No prior exposure to programming is
expected.
4
Welcome Python Programming E&ICT IIT Kanpur
A Computer?
Almost all electronic gadgets today are Computers.
They are everywhere! 5
Welcome Python Programming E&ICT IIT Kanpur
Why should I do this course?
• Computers are everywhere
• Understand how computers work
• Write your own programs
• Understand how computers can
be used to automate repetitive tasks
6
Welcome Python Programming E&ICT IIT Kanpur
Process of Programming
Problem
Description
X
Solution Model of the
Code Problem
Logical
Solution
7
Welcome Python Programming E&ICT IIT Kanpur
Process of Programming
Problem
Description
Solution Model of the
Code Problem
With experience, the
Logical separation between
Solution these stages blurs
8
Welcome Python Programming E&ICT IIT Kanpur
Process of Programming: Step 1
• Define and model the problem. In real-life this is
important and complicated.
• For example, consider modelling the Indian Railways
reservation system.
• If model is not proper, end result will be
unsatisfactory!
9
Welcome Python Programming E&ICT IIT Kanpur
Process of Programming: Step 2
➢Obtain a logical solution to your problem.
➢A logical solution is a finite and clear
step-by-step procedure to solve your
problem.
➢Also called an Algorithm.
➢We can visualise this using a Flowchart.
➢Very important step in the programming
process.
10
Welcome Python Programming E&ICT IIT Kanpur
Algorithms in real-life
• Recipes (say, for a cake.)
11
Welcome Python Programming E&ICT IIT Kanpur
Algorithms in real-life
• Assembly instructions for a make-
it-yourself kit.
http://www.gocomics.com/calvinandhobbes/2009/06/02
12
Welcome Python Programming E&ICT IIT Kanpur
Process of Programming: Step 3
➢Convert the Algorithm into working code.
➢This is the stage where you require a
language to communicate with the
computer
➢Syntax and Semantics of the language
➢If your model or the logical solution is
wrong, the program will also be wrong
➢Garbage In, Garbage Out
13
Welcome Python Programming E&ICT IIT Kanpur