Page 267 - Ai_V1.0_Class9
P. 267

S. No.                                           Program

                   4     To find the sum of two numbers 15 and 20.
                         N1=15
                         N2=20
                         print("The sum of two numbers is : ",N1+N2)
                         Output:
                         The sum of two numbers is : 35

                   5     To convert length given in kilometers into meters.
                         Length=2.5
                         print("Length given in kilometers is : ",Length," kms")
                         print("Length converted in meters is : ",Length*1000," meters")
                         Output:
                         Length given in kilometers is : 2.5  kms
                         Length converted in meters is : 2500.0  meters
                   6     To print the table of 5 up to five terms.

                         N=5
                         print("The table of 5 upto 5 terms are: ")
                         print(N,"×",1,"=",N*1)
                         print(N,"×",2,"=",N*2)
                         print(N,"×",3,"=",N*3)
                         print(N,"×",4,"=",N*4)
                         print(N,"×",5,"=",N*5)
                         Output:
                         The table of 5 upto 5 terms are:
                         5 × 1 = 5
                         5 × 2 = 10
                         5 × 3 = 15
                         5 × 4 = 20
                         5 × 5 = 25
                   7     To calculate Simple Interest if the principle_amount = 2000 rate_of_interest = 4.5 time = 10

                         P=2000;R=4.5;T=10
                         SI=(P*R*T)/100
                         print("Simple Interest is : ",SI)
                         Output:
                         Simple Interest is : 900.0
                   8     To calculate Area and Perimeter of a rectangle

                         Length=int(input("Enter Length : "))
                         Breadth=int(input("Enter Breadth : "))
                         print("Area of Rectangle is : ",Length*Breadth)
                         print("Perimeter of Rectangle is : ",2*(Length+Breadth))
                         Output:
                         Enter Length : 10
                         Enter Breadth : 20
                         Area of Rectangle is : 200
                         Perimeter of Rectangle is : 60

                                                                                   Python Practical Questions   265
   262   263   264   265   266   267   268   269   270   271   272