Page 394 - Ai_417_V3.0_C9_Flipbook
P. 394

Step 3   FullName= FirstName + LastName
                                                                                               Flowchart
               Step 4   Display FullName
                                                                                                  START
               Step 5   Stop

              Source Code:
                                                                                                 INPUT
              FirstName=input("Enter your First Name: ")                                  First Name, Last Name
              LastName=input("Enter your Last Name: ")

              FullName=FirstName+" "+LastName
                                                                                      FullName=First Name+Last Name
              print("Hello! "+FullName+" Welcome to the World of
              Python")
              Output:                                                                            Display
                                                                                                Full Name
              Enter your First Name: Megha
              Enter your Last Name: Sharma
              Hello! Megha Sharma Welcome to the World of Python
                                                                                                  STOP

                Program 2:  Input the length and breadth of a rectangle. Calculate the area and perimeter.
              Algorithm                                                                         Flowchart
               Step 1   Start
                                                                                                  START
               Step 2   Input Length, Breadth

               Step 3   Area=Length × Breadth
               Step 4   Perimeter= 2(Length + Breadth)                                      Input Length, Breadth

               Step 5   Display "Area is ", Area

               Step 6   Display "Perimeter is ", Perimeter
                                                                                            Area=Length×Breadth
               Step 7   Stop
              Source Code:
                                                                                         Perimeter=2(Length+Breadth)
              Length= int(input('Enter Length:'))
              Breadth = int(input('Enter Breadth:'))
              Area= Length*Breadth                                                         Display "Area is:", Area
              Perimeter=2*(Length + Breadth)

              print("Area is:", Area)
                                                                                            Display "Perimeter is:",
              print("Perimeter is:", Perimeter)
                                                                                                 Perimeter
              Output:
              Enter Length: 25
                                                                                                  STOP
              Enter Breadth: 63
              Area is: 1575
              Perimeter is: 176







                    392     Touchpad Artificial Intelligence (Ver. 3.0)-IX
   389   390   391   392   393   394   395   396   397   398   399