Page 363 - Ai_417_V3.0_C9_Flipbook
P. 363

Disadvantages of an Algorithm

                 The disadvantages of an algorithm are as follows:
                    • There is no standard rule for writing an algorithm, it varies drastically.
                    • The process of creating an algorithm can be time-consuming.
                    • It is difficult to represent branching and looping in an algorithm.



                                 Task                                                   #Experiential Learning


                     Do you think of any other way of making a different kind of sandwich? If yes, write the steps in the form
                     of an algorithm.















                 Let us look at some other examples of algorithms.
                 1.  Input the temperature in Fahrenheit and convert it into Celsius and display it.
                    Step 1   Start

                    Step 2   Input Temp(in Fahrenheit)
                    Step 3   C=(5/9)*(Temp-32)
                    Step 4   Display C
                    Step 5   Stop
                 2.  Input the radius of a circle and calculate its area.

                    Step 1   Start
                    Step 2   Input radius
                    Step 3   Area=3.14*radius*radius

                    Step 4   Display Area
                    Step 5   Stop
                 3.  Input an age and check whether eligible for a driving licence or not.
                    Step 1   Start
                    Step 2   Input Age

                    Step 3   If Age>=18 then
                                  Display "Eligible"
                    Step 4   else
                                  Display "Not Eligible"

                    Step 5   Stop
                 4.  Display even numbers from 2 to 20.
                    Step 1   Start

                                                                                        Introduction to Python  361
   358   359   360   361   362   363   364   365   366   367   368