Page 353 - Artificial Intellegence_v2.0_Class_9
P. 353

S. No.                                           Program
                  9    To calculate Area of a triangle with Base and Height

                       Base=int(input("Enter Base :"))
                       Height=int(input("Enter Height :"))
                       print("Area of Triangle is :",(1/2)*Base*Height)
                       Output:
                       Enter Base : 10
                       Enter Height : 15
                       Area of Triangle is : 75.0

                 10    To calculating average marks of 3 subjects
                       Eng=float(input("Enter Eng Marks :"))
                       Maths=float(input("Enter Maths Marks :"))

                       Science=float(input("Enter Science Marks :"))
                       print("Average of 3 subjects is :",round((Eng+Maths+Science)/3,2))
                       Output:
                       Enter Eng Marks : 90
                       Enter Maths Marks : 95
                       Enter Science Marks : 87
                       Average of 3 subjects is : 90.67
                 11    To calculate discounted amount with discount %

                       Amt=int(input("enter an Amount :"))
                       Discount=int(input("enter Discount :"))
                       print("The discounted amount is :",Amt-Discount)
                       print("The discount % is :",(Discount/Amt)*100)
                       Output:
                       enter an Amount : 100
                       enter Discount : 24
                       The discounted amount is : 76
                       The discount % is : 24.0
                 12    To calculate Surface Area and Volume of a Cuboid

                       Length=int(input("Enter Length :"))
                       Breadth=int(input("Enter Breadth :"))
                       Height=int(input("Enter Height :"))
                       Volume=Length*Breadth*Height
                       print("Volume of Cuboid is :",Volume)
                       Surface_Area=2*((Length*Breadth)+(Breadth*Height)+(Length*Height))
                       print("Surface Area of Cuboid is :",Surface_Area)
                       Output:
                       Enter Length : 10
                       Enter Breadth : 8
                       Enter Height : 5
                       Volume of Cuboid is : 400
                       Surface Area of Cuboid is : 340


                                                                               Python Practical Questions  351
   348   349   350   351   352   353   354   355   356   357   358