Artificial Intelligence IX Practical Assignments Solution
Artificial Intelligence IX Practical Assignments Solution
Class IX – A & B
Practical Assignments
1. Input Firstname, Middlename and Lastname from a user and display full name.
Flowchart
Program
#INPUT
#OUTPUT
Output
Flowchart
Program
#INPUT
#CALCULATION
sum = a+b
diff = a-b
prod = a*b
qtn = a//b
rem = a%b
#OUTPUT
Output
The sum is = 10
The difference is = 4
The product is = 21
The quotient is = 2
The remainder is = 1
3. Input distance covered and time taken by a car from the user and find the speed of the car.
Flowchart
Program
#INPUT
#CALCULATION
v = d/t
#OUTPUT
Output
4. Input Principal, Rate of interest and time period from the user and find the total interest paid
and total amount as per
i. Simple interest
ii. Compound interest
Flowchart
Program
#INPUT
#CALCULATION
SI = p*r*t/100
STA = p + SI
CTA = p*(1 + r/100)**t
CI = CTA - p
#OUTPUT
Output
Flowchart
Program
import math
#INPUT
#CALCULATION
p = (a+b+c)
s = p/2
a = math.sqrt(s*(s-a)*(s-b)*(s-c))
#OUTPUT
Output
Flowchart
Program
import math
#INPUT
#CALCULATION
p = 2*math.pi*r
a = math.pi*(r**2)
#OUTPUT
Output
Flowchart
Program
#INPUT
a = float(input("Enter a : "))
b = float(input("Enter b : "))
c = float(input("Enter c : "))
d = float(input("Enter d : "))
#CALCULATION
#OUTPUT
Output
Enter a : 10
Enter b : 3
Enter c : 12
Enter d : 7
Program
#INPUT
#CALCULATION
LE = L[0:len(L):2]
#OUTPUT
print("The elements in the even positions in the list are : ", LE)
Output
The elements in the even positions in the list are : [5.2, 10.4, 45]
Program
#INPUT
Output
Program
L = [7,9,2,5,4]
#CALCULATION
L.pop()
L.remove(9)
L.extend([1, 3])
L.insert(3, 6)
#DISPLAY
Output
___________