Professional Documents
Culture Documents
Lab Report-1
Course Title: Artificial Intelligence Lab
Course Code: CSE-404
Section: DA
[For Teachers use only: Don’t Write Anything inside this box]
Task-2: Task-2: Write a Python program to convert an array to an ordinary list with
the same items.
Task-3: Task-3: Write a Python program to remove duplicates from the dictionary.
2 OBJECTIVES/AIM:
(i)Create some instances and check whether instances of the said classes or not and also
check said classes are builtin object class or not.
(ii) Convert array to an ordinary list with the same items.
(iii) Remove duplicates from the dictionary.
3 PROCEDURE:
First task: In this program, I’m define two empty classes, Student and Marks, using the
class keyword. Then create some instances of these classes using the () operator, and store
them in variables s1, s2, m1, and m2. Then I’m use the isinstance() function to check if
each of these instances is an instance of the respective class. Then print the output of these
checks using the print() function. Finally, I’m use the issubclass() function to check if the
Student and Marks classes are subclasses of the built-in object class. Then print the output
of these checks using the print() function.
Second task: In this program, First I’m import the array module. Then create an ar-
ray arr of type i (integer) and initialize it with some values. Then convert this array to an
ordinary list using the list() function, and store it in a variable lst. Finally, I’m print the list
lst, which should contain the same items as the original array arr.
Third task: In this program, I’m define an input dictionary input-dict that contains some
duplicate values. Then define an empty output dictionary output-dict that will contain the
unique values from input-dict. Then I’m loop over each key-value pair in input-dict using
the items() method. For each pair, I’m check if the value already exists in the values() of
output-dict. If it does not exist, then add the key-value pair to output-dict. Finally, I’m
print the output-dict, which should contain only the unique key-value pairs from input-dict.
4 IMPLEMENTATION:
Task-1:
Task-2:
Task-3:
5 OUTPUT:
Task-1:
First of all, I’m check to this class are instances class or not. If the class are
instance then it print true otherwise its print false. Then I’m check those
classes are subclasses of the built-in object class or not. If the said subclasses
are built-in object then print true otherwise its print false.
Task-2:
Here, we see two array output. First array shows integer contain array and
Second array is shown by floating contain array.
Task-3:
I’m firstly define lots of duplicate input in a dictionary. Then using for key
to keep the input and use if logic to remove duplicate inputs.
6 DISCUSSION:
In this lab, teacher makes us practice a lot of Python programming to
improve. Complete this report, I am facing some problem which is creating
instance and builtin object class and the main problem I have is creating two
simple list items.
7 SUMMARY:
First task, I’m check to this class are instances class or not and also check
whether the said classes are subclasses of the builtin object class or no.
Then second task, I’m converting two array to an ordinary list that is
integer and floating.
Then Third task, I’m removing duplicates input to the dictionary.