Page 267 - AI Ver 1.0 Class 9
P. 267

UNIT 4


                                                                  IntroductIon to


                                                                               Python











                             Learning Outcomes



                •  Steps Involved in Computer Problem Solving   •  Control Structures
                •  Algorithm                                    •  Flowcharts
                •  Difference between Algorithm and Flowchart   •  What is CodeCombat?
                •  What is Python?                              •  Important Features of Python
                •  Role of Python in Artificial Intelligence    •  Important uses of Python
                •  Installing Python                            •  Working in Python
                •  Python Character Set                         •  Statements in Python
                •  Tokens                                       •  Operator Precedence
                •  Comments in Python                           •  The print() Function
                •  The input() Function                         •  Errors in Python
                •  Control Statements                           •  Sequential Statements
                •  Selection Statements                         •  Iterative  Statements
                •  Lists in Python


            A computer is just a machine that gives the result based on the instructions or inputs given to it. In order to
            get a problem solved by a computer, we need to give step-by-step instructions to the computer. These step-by-
            step instructions written in any programming language to do a specific task is known as a program. A program
            is written in any programming language which the computer can understand and execute. Algorithms and
            flowchart are powerful tools for learning programming.

            In this chapter, we are going to learn about basic concepts of programming including problem solving, control
            structure, algorithm and flowchart.


                    Steps Involved in Computer Problem Solving


            Before we write a program, we need to learn the basic objective of it. Why do we need a program and what
            purpose does it solve?
            To solve this problem of writing a program we follow some steps as given below:
            1.  Understanding the Problem: This is a very important and difficult step where we need to understand the
              main objective of a problem. Give more time to this step as the better you understand the problem, the easier
              it will be to solve it.
            2.  Analyzing the Problem: In this step, we analyse what kind of data can be given as an input, what formula or
              tool to use to do the processing and in which format the output will be displayed.
            3.  Developing the Solution: We can use problem-solving tools like algorithms or flowcharts to design the
              step-by-step instructions for developing the solution of a given problem. It is always recommended to first
              write an algorithm and draw a flowchart for solving a problem and then only write the program.

                                                                                Introduction to Python  265
   262   263   264   265   266   267   268   269   270   271   272