Programming using Python prutor.ai 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 prutor.ai 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. prutor.ai 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. prutor.ai 4 Welcome Python Programming E&ICT IIT Kanpur A Computer? prutor.ai 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 prutor.ai 6 Welcome Python Programming E&ICT IIT Kanpur Process of Programming Problem Description prutor.ai X Solution Code Model of the Problem Logical Solution 7 Welcome Python Programming E&ICT IIT Kanpur Process of Programming Problem Description prutor.ai Solution Code Model of the 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. prutor.ai • 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. prutor.ai ➢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.) prutor.ai 11 Welcome Python Programming E&ICT IIT Kanpur Algorithms in real-life • Assembly instructions for a makeit-yourself kit. prutor.ai 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 prutor.ai ➢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