Page 298 - AI Ver 1.0 Class 9
P. 298
3. Add milk
4. Churn the mixer jar
5. Pour in a glass
Let us do some more examples:
• Input First name and Last name from the user and display full name.
Algorithm Flowchart
Start
Input FirstName START
Input LastName
FullName= FirstName + LastName INPUT
Display FullName First Name, Last Name
Stop
Source Code: FullName=First Name+Last Name
FirstName=input("Enter your First Name :")
LastName=input("Enter your Last Name :")
Display
FullName=FirstName+" "+LastName Full Name
print("Hello !" +FullName+" Welcome to the World of Python")
Output:
Enter your First Name :Suzan STOP
Enter your Last Name :Christopher
Hello !Suzan Christopher Welcome to the World of Python
• Input Length and Breadth of a Rectangle. Calculate the Area and Perimeter
Algorithm Flowchart
Start
Input Length, Breadth START
Area=Length X Breadth
Perimeter= 2(Length X Breadth)
Display "Area is ", Area Input Length, Breadth
Display "Perimeter is ", Perimeter
Stop
Area=Length×Breadth
Source Code:
Length= int(input('Enter Length:')) Perimeter=2(Length×Breadth)
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
STOP
296 Touchpad Artificial Intelligence-IX

