[go: up one dir, main page]

0% found this document useful (0 votes)
95 views24 pages

AI Pratical File (Indervir Singh)

AI Pratical File
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views24 pages

AI Pratical File (Indervir Singh)

AI Pratical File
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

ARTIFICIAL INTELLIGENCE

Pratical File

SUBMITTED BY:- SUBMITTED TO:-

NAME: Indervir singh Dr. Parvinder kaur

CLG ROLL NO.: D-201298

UNI. ROLL NO: 2100654

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BABA BANDA SINGH BAHADUR ENGINEERING COLLEGE,


FATEHGARH SAHIB
INDEX
Sr Name of the Experiment Page Date Sign
No. No.
1 Introduction to Python 1 to 2 28-02-2023
2 Operators in Python 3 to 5 7-03-2023
3 DFS 6 21-03-2023
4 BFS 7 21-03-2023
5 A* Search 8 to 9 28-03-2023
6 Game search(Tic-Tac-Toe) 10 to 12 28-03-2023
7 Constuct a Bayesian network for given data. 13 to 14 4-04-2023
8 Infer from the bayesian network. 15 11-04-2023
9 run value and policy iteration in a grid world. 16 to 19 25-04-2023
10 To do reinforcement learning in a grid world. 20 to 23 25-04-2023

2|Page
Task 1 Date:- 28-02-2023

AIM:- Introduction to Python.

Introduction to python

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is


designed to be highly readable. It uses English keywords frequently where as other languages
use punctuation, and it has fewer syntactical constructions than other languages.

• Python is Interpreted − Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.
• Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
• Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.
• Python is a Beginner's Language − Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications from simple text
processing to WWW browsers to games.

History of Python

 Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.
 Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-
68, Smalltalk, and Unix shell and other scripting languages.
 Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).

Applications

1. GUI based desktop applications


2. Graphic design, image processing applications, Games, and Scientific/ computational
Applications
3. Web frameworks and applications
4. Enterprise and Business applications
5. Operating Systems
6. Education
7. Database Access
8. Language Development
9. Prototyping
10. Software Development

1
Features in python

1. Free and Open Source : Python language is freely available at the official website and you
can download it from the given download link below click on the Download Python keyword.
2. Easy to code: Python is very easy to learn the language as compared to other languages like
C, C#, Javascript, Java, etc. It is very easy to code in the Python language and anybody can learn
Python basics in a few hours or days.
3. Easy to Read: As you will see, learning Python is quite simple. As was already established,
Python’s syntax is really straightforward. The code block is defined by the indentations rather
than by semicolons or brackets.
4. Object-Oriented Language: One of the key features of Python is Object-Oriented
programming. Python supports object-oriented language and concepts of classes, object
encapsulation, etc.
5. GUI Programming Support: Graphical User interfaces can be made using a module such as
PyQt5, PyQt4, wxPython, or Tk in python. PyQt5 is the most popular option for creating
graphical apps with Python.
6. High-Level Language: Python is a high-level language. When we write programs in Python,
we do not need to remember the system architecture, nor do we need to manage the memory.
7. Extensible feature: Python is an Extensible language. We can write some Python code into C
or C++ language and also we can compile that code in C/C++ language.
8. Easy to Debug: You will be able to quickly identify and correct the majority of your
program’s issues once you understand how to interpret Python’s error traces.
9. Python is a Portable language: Python language is also a portable language. For example, if
we have Python code for windows and if we want to run this code on other platforms such as
Linux, Unix, and Mac then we do not need to change it, we can run this code on any platform.
10. Python is an Integrated language: Python is also an Integrated language because we can
easily integrate Python with other languages like C, C++, etc.
11. Dynamically Typed Language: Python is a dynamically-typed language. That means the
type (for example- int, double, long, etc.) for a variable is decided at run time not in advance
because of this feature we don’t need to specify the type of variable.

2
Task 2 Date:- 7-03-2023

AIM:- Operators in Python.

Operators are used to perform operations on variables and values.

1. Arithmetic operators: Arithmetic operators are used with numeric values to perform
common mathematical operations.

a=int(input("Enter a value = "))


b=int(input("Enter b value = "))
print("Addition of a and b : ",a+b)
print("Subtraction of a and b : ",a-b)
print("Multiplication of a and b : ",a*b)
print("Division of a and b : ",a/b)
print("Remainder of a and b : ",a%b)
print("Exponent of a and b : ",a**b)
print("Floar division of a and b : ",a//b)

OUTPUT:

2. Comparison operators: Comparison operators are used to compare two values:

a = 13
b = 33
print(a > b)
print(a < b)
print(a == b)
print(a != b)
print(a >= b)
print(a <= b)

OUTPUT:

3
3. Logical operators: Logical operators are used to combine conditional statements:

a = True
b = False
print(a and b)
print(a or b)
print(not a)

OUTPUT:

4. Assignment operators: Assignment operators are used to assign values to variables:

a = 10
b=a
print(b)
b += a
print(b)
b -= a
print(b)
b *= a
print(b)
b <<= a
print(b)

OUTPUT:

5. Identity operators: Identity operators are used to compare the objects, not if they are equal,
but if they are actually the same object, with the same memory location:

a = 10
b = 20

4
c=a
print(a is not b)
print(a is c)

OUTPUT:

6. Bitwise operators: Bitwise operators are used to compare (binary) numbers:

a = 10
b=4
print(a & b)
print(a | b)
print(~a)
print(a ^ b)
print(a >> 2)
print(a << 2)

OUTPUT:

7. Membership operators: Membership operators are used to test if a sequence is presented in


an object:

x = 24
y = 20
list = [10, 20, 30, 40, 50]

if (x not in list):
print("x is NOT present in given list")
else:
print("x is present in given list")

if (y in list):
print("y is present in given list")
else:
print("y is NOT present in given list")
OUTPUT:

5
Task 3 Date:- 21-03-2023

AIM:- Write a programme to conduct uninformed search( Depth first search).

from collections import defaultdict


class Graph:
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self, u, v):
self.graph[u].append(v)
def DFSUtil(self, v, visited):
visited.add(v)
print(v, end=' ')
for neighbour in self.graph[v]:
if neighbour not in visited:
self.DFSUtil(neighbour, visited)
def DFS(self, v):
visited = set()
self.DFSUtil(v, visited)
if __name__ == "__main__":
g = Graph()
g.addEdge(0, 1)
g.addEdge(0, 2)
g.addEdge(1, 2)
g.addEdge(2, 0)
g.addEdge(2, 3)
g.addEdge(3, 3)
print("Following is DFS from (starting from vertex 2)")
g.DFS(2)

OUTPUT:-

6
Task 4 Date:- 21-03-2023

AIM:- Write a programme to conduct uninformed search (Breadth first


search).

from collections import defaultdict


class Graph:
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self, u, v):
self.graph[u].append(v)
def BFS(self, s):
visited = [False] * (max(self.graph) + 1)
queue = []
queue.append(s)
visited[s] = True
while queue:
s = queue.pop(0)
print(s, end=" ")
for i in self.graph[s]:
if visited[i] == False:
queue.append(i)
visited[i] = True
g = Graph()
g.addEdge(0, 1)
g.addEdge(0, 2)
g.addEdge(1, 2)
g.addEdge(2, 0)
g.addEdge(2, 3)
g.addEdge(3, 3)
print("Following is Breadth First Traversal"
" (starting from vertex 2)")
g.BFS(2)

OUTPUT:-

7
Task 5 Date:- 28-03-2023

AIM:-Write a programme to conduct informed search algorithm (A* Search).

from collections import deque


class Graph:
def __init__(self, adjacency_list):
self.adjacency_list = adjacency_list
def get_neighbors(self, v):
return self.adjacency_list[v]
def h(self, n):
H={
'A': 1,
'B': 1,
'C': 1,
'D': 1
}
return H[n]
def a_star_algorithm(self, start_node, stop_node):
open_list = set([start_node])
closed_list = set([])
g = {}
g[start_node] = 0
parents = {}
parents[start_node] = start_node
while len(open_list) > 0:
n = None
for v in open_list:
if n == None or g[v] + self.h(v) < g[n] + self.h(n):
n = v;
if n == None:
print('Path does not exist!')
return None
if n == stop_node:
reconst_path = []
while parents[n] != n:
reconst_path.append(n)
n = parents[n]
reconst_path.append(start_node)
reconst_path.reverse()
print('Path found: {}'.format(reconst_path))
return reconst_path
for (m, weight) in self.get_neighbors(n):
if m not in open_list and m not in closed_list:
open_list.add(m)

8
parents[m] = n
g[m] = g[n] + weight
else:
if g[m] > g[n] + weight:
g[m] = g[n] + weight
parents[m] = n
if m in closed_list:
closed_list.remove(m)
open_list.add(m)
open_list.remove(n)
closed_list.add(n)
print('Path does not exist!')
return None
adjacency_list = {
'A': [('B', 1), ('C', 3), ('D', 7)],
'B': [('D', 5)],
'C': [('D', 12)]
}
graph1 = Graph(adjacency_list)
graph1.a_star_algorithm('A', 'D')

OUTPUT:-

9
Task 6 Date:- 28-03-2023

AIM:-Write a programme to conduct game search.


import random
class TicTacToe:
def __init__(self):
self.board = []
def create_board(self):
for i in range(3):
row = []
for j in range(3):
row.append('-')
self.board.append(row)
def get_random_first_player(self):
return random.randint(0, 1)
def fix_spot(self, row, col, player):
self.board[row][col] = player
def is_player_win(self, player):
win = None
n = len(self.board)
for i in range(n):
win = True
for j in range(n):
if self.board[i][j] != player:
win = False
break
if win:
return win
for i in range(n):
win = True
for j in range(n):
if self.board[j][i] != player:
win = False
break
if win:
return win
win = True
for i in range(n):
if self.board[i][i] != player:
win = False
break
if win:
return win
win = True
for i in range(n):

10
if self.board[i][n - 1 - i] != player:
win = False
break
if win:
return win
return False
for row in self.board:
for item in row:
if item == '-':
return False
return True
def is_board_filled(self):
for row in self.board:
for item in row:
if item == '-':
return False
return True
def swap_player_turn(self, player):
return 'X' if player == 'O' else 'O'
def show_board(self):
for row in self.board:
for item in row:
print(item, end=" ")
print()
def start(self):
self.create_board()
player = 'X' if self.get_random_first_player() == 1 else 'O'
while True:
print(f"Player {player} turn")
self.show_board()
row, col = list(
map(int, input("Enter row and column numbers to fix spot: ").split()))
print()
self.fix_spot(row - 1, col - 1, player)
if self.is_player_win(player):
print(f"Player {player} wins the game!")
break
if self.is_board_filled():
print("Match Draw!")
break
player = self.swap_player_turn(player)
print()
self.show_board()
tic_tac_toe = TicTacToe()
tic_tac_toe.start()

11
OUTPUT:-

12
Task 7 Date:- 4-04-2023

AIM:-Write a program to construct a bayesian network for the given data.


import numpy as np
import pandas as pd
import csv
from pgmpy.estimators import MaximumLikelihoodEstimator
from pgmpy.models import BayesianModel
from pgmpy.inference import VariableElimination
heartDisease = pd.read_csv('heart.csv')
heartDisease = heartDisease.replace('?',np.nan)
print('Sample instances from the dataset are given below')
print(heartDisease.head())
print('\n Attributes and datatypes')
print(heartDisease.dtypes)
model=
BayesianModel([('age','heartdisease'),('sex','heartdisease'),('exang','heartdisease'),
('cp','heartdisease'),('heartdisease','restecg'),('heartdisease','chol')])
print('\nLearning CPD using Maximum likelihood estimators')
model.fit(heartDisease,estimator=MaximumLikelihoodEstimator)
print('\n Inferencing with Bayesian Network:')
HeartDiseasetest_infer = VariableElimination(model)
print('\n 1. Probability of HeartDisease given evidence= restecg')
q1=HeartDiseasetest_infer.query(variables=['heartdisease'],evidence={'restecg':1})
print(q1)
print('\n 2. Probability of HeartDisease given evidence= cp ')
q2=HeartDiseasetest_infer.query(variables=['heartdisease'],evidence={'cp':2})
print(q2)

Given dataset:
se restec
age x cp trestbps chol fbs g thalach exang oldpeak slope ca thal Heartdisease

63 1 1 145 233 1 2 150 o 2.3 3 o 6 o

67 1 4 160 286 o 2 108 1 1.5 2 3 3 2

67 1 4 120 229 o 2 129 1 2.6 2 2 7 1

41 O 2 130 204 o 2 172 o 1.4 1 o 3 o

62 O 4 140 268 o 2 160 o 3.6 3 2 3 3

60 1 4 130 206 o 2 132 1 2.4 2 2 7 4

13
OUTPUT:-

14
Task 8 Date:- 11-04-2023

AIM:-Write a program to infer from the bayesian network.


import jpype
classpath = "C:\\Program Files\\Bayes Server\\Bayes Server 9.5\\API\\Java\\bayesserver- 9.5.jar"
from com.bayesserver import * from com.bayesserver.inference import *
network = Network('Demo')
aTrue = State('True') aFalse = State('False') a = Node('A', [aTrue, aFalse])
bTrue = State('True') bFalse = State('False') b = Node('B', [bTrue, bFalse])
cTrue = State('True') cFalse= State('False')
c = Node('C', [cTrue, cFalse])
dTrue = State('True') dFalse= State('False') d = Node('D', [dTrue, dFalse])
nodes = network.getNodes()
nodes.add(a) nodes.add(b) nodes.add(c) nodes.add(d) = network.getLinks() links.add(Link(a, b))
links.add(Link(a, c)) links.add(Link(b, d)) links.add(Link(c, d))
tableA = a.newDistribution().getTable() tableA.set(0.1, [aTrue]) tableA.set(0.9, [aFalse])
a.setDistribution(tableA)
tableB = b.newDistribution().getTable() tableB.set(0.2, [aTrue, bTrue]) tableB.set(0.8, [aTrue,
bFalse]) tableB.set(0.15, [aFalse, bTrue]) tableB.set(0.85, [aFalse, bFalse])
b.setDistribution(tableB)
tableC = c.newDistribution().getTable() tableC.set(0.3, [aTrue, cTrue]) tableC.set(0.7, [aTrue,
cFalse]) tableC.set(0.4, [aFalse, cTrue]) tableC.set(0.6, [aFalse, cFalse]) c.setDistribution(tableC)
tableD = d.newDistribution().getTable() iteratorD
= TableIterator(tableD, [b, c, d])
iteratorD.copyFrom([0.4, 0.6, 0.55, 0.45, 0.32, 0.68, 0.01, 0.99])
d.setDistribution(tableD) if False:
network.save('fileName.bayes')
inference.getEvidence().setState(dTrue)
queryA = Table(a) inference.getQueryDistributions().add(QueryDistribution(queryA))
inference.query(queryOptions, queryOutput)
print(f'P(A|D=True) = [{queryA.get([aTrue])},{queryA.get([aFalse])}]')
inference.getEvidence().setState(cTrue) queryOptions.setLogLikelihood(True)
inference.query(queryOptions, queryOutput)
print(f'P(A|D=True, C=True) = [{queryA.get([aTrue])},{queryA.get([aFalse])}], log-likelihood
= {queryOutput.getLogLikelihood()}.')

OUTPUT:-

15
Task 9 Date:- 25-04-2023

AIM:-Write a programme to run value and policy iteration in a grid world.


import numpy as np from pprint
import pprint, pformat
class Cell(object): def
_init_ (self):
self.is_terminal = False
self.policy = '' self.value = 0
def str (self): return
pformat(self. dict ) def
_repr_ (self): return self. str ()
world_bounds_rows = 3 world_bounds_cols = 4 world_input =
np.array([[0,0,0,100], [0,np.nan,0,-100], [0,0,0,0]])
class GridWorld(object): def
_init_ (self, array):
cells = [] for row_idx, row in enumerate(array):
cells.append([]) for col_idx, value in enumerate(row):
cell = Cell()
cell.row = row_idx
cell.col = col_idx
cell.value = value
assert len(cells[row_idx]) == world_bounds_cols
assert len(cells) == world_bounds_rows
cells[0][3].is_terminal = True
cells[1][3].is_terminal = True
self.cells = cells
def policy(self):
return [[c.policy for c in rows]
for rows in self.cells]
def _iter_ (self):
for row in self.cells:
for cell in row:
yield cell
def as_array(self): a = [ [cell.value for cell in row] for row in self.cells ]
return np.array(a)
def north(self, cell):
row = cell.row;
col = cell.col if row > 0:
row -= 1 return
self._next_cell_if_not_blocked(cell, row, col)
def south(self, cell): row = cell.row; col = cell.col
if row < world_bounds_rows-1:
row += 1 return
self._next_cell_if_not_blocked(cell, row, col)

16
def west(self, cell): row = cell.row; col = cell.col
if col > 0: col -= 1 return
self._next_cell_if_not_blocked(cell, row, col)
def east(self, cell): row = cell.row; col = cell.col
if col < world_bounds_cols-1: col += 1
return self._next_cell_if_not_blocked(cell, row, col)
def _next_cell_if_not_blocked(self, cell, row, col):
n = self.cells[row][col]
if n.blocks: return
cell
return n
def str (self): return
pformat(self.as_array())
def repr (self): return
self. str ()
class ValueIterationAlgo(object): def
__init__ (self, discount_factor, world): self.discount_factor = discount_factor
self.world = world
def update(self, state):
if state.is_terminal or state.blocks: return
max_pv = 0
= [0.8*self.world.north(state).value + 0.1*self.world.west(state).value +
0.1*self.world.east(state).value, 0.8*self.world.south(state).value +
0.1*self.world.west(state).value +
0.1*self.world.east(state).value,
0.8*self.world.east(state).value + 0.1*self.world.north(state).value +
0.1*self.world.south(state).value,
0.8*self.world.west(state).value + 0.1*self.world.north(state).value +
0.1*self.world.south(state).value]
moves_directions = ['north', 'south', 'east', 'west'] max_idx = np.argmax(moves_pvs)
max_pv = moves_pvs[max_idx] policy= moves_directions[max_idx]
state.value = self.discount_factor * max_pv + state.reward state.policy = policy
def str (self): return
pformat(self. dict )
def repr (self):
return self.
str ()
def done(): global world, prev_world
diff = np.abs(world.as_array() - prev_world) except RuntimeWarning:
pass return not (diff > epsilon).any()
epsilon = 0.0001 discount_factor = 0.9
def part_b(): global world, prev_world
world =
GridWorld(world_input) prev_world = np.ones_like(world_input)
print 'iteration {}'.format(iter_cnt).center(72, '-')
pprint(prev_world)

17
if done(): break
prev_world = world.as_array()
pprint(prev_world)
for cell in world: algo.update(cell) iter_cnt += 1
world_arr = world.as_array()
pprint(world_arr)
pprint(np.round(world_arr))
pprint(world.policy())
def part_c():
global world, prev_world discount_factor = 0.9
while(True):
world = GridWorld(world_input)
prev_world = np.ones_like(world_input)
print 'iteration {}, discount={}'.format( iter_cnt, discount_factor).center(72, '-')
pprint(prev_world)
if done(): break
prev_world = world.as_array()
pprint(prev_world)
for cell in world:
algo.update(cell)
iter_cnt += 1
world_arr = world.as_array()
pprint(world_arr)
pprint(np.round(world_arr))
pprint(world.policy())
if world.cells[2][3].policy != 'west': break discount_factor - = 0.01
print 'part b:' part_b()
print 'part c:' part_c()

OUTPUT:-

18
Task 10 Date:- 25-04-2023

AIM:-Write a programme to do reinforcement learning in a grid world.


import numpy as np
grid = np.zeros((5,5)) grid Y = .90 #discount value
for num in range(10):
for I in range(5):
for j in range(5):
up_grid = grid[i-1][j] if i > 0 else None
down_grid = grid[i+1][j] if i < 4 else None #
left_grid = grid[i][j-1] if j > 0 else None
right_grid = grid[i][j+1] if j < 4 else None
all_dirs = [up_grid, down_grid, left_grid, right_grid]
value=0
if i==0 and j==1:

19
value = 10 + Y*grid[4][1]
elif i==0 and j==3:
value = 5 + Y*grid[2][3]
else:
for direc in all_dirs:
if direc != None:
value += .25 * (0 + Y*direc)
else: value += .25 * (-1 + Y*grid[i][j])
grid[i][j] = value np.round(grid, 1)
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "RL_gridworld.ipynb", "provenance": [], "collapsed_sections": []
},
"kernelspec": { "name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown", "metadata": {
"id": "myRaAcABGHFC", "colab_type": "text"
},
"source": [
"# GridWorld State Value for all states"
]
},
{
"cell_type": "code", "metadata": {
"id": "SFh0zR4Bob25", "colab_type": "code", "colab": {
"base_uri": "https://localhost:8080/", "height": 104
}
"outputId": "24789b8a-3715-46c7-bb0f-cf5222fb5fdf"
},
"source": [
"import numpy as np\n", "\n",
"grid = np.zeros((5,5))\n", "grid"
],
"execution_count": 1, "outputs": [
{
"output_type": "execute_result", "data": {
"text/plain": [
"array([[0., 0., 0., 0., 0.],\n",

20
" [0., 0., 0., 0., 0.],\n",
" [0., 0., 0., 0., 0.],\n",
" [0., 0., 0., 0., 0.],\n",
" [0., 0., 0., 0., 0.]])"
]
},
"metadata": {
"tags": []
},
"execution_count": 1
}
]
},
{
"cell_type": "code", "metadata": {

"id": "6T1uH2KYHBTY",
"colab_type": "code", "colab": {}
},
"source": [
"Y = .90 #discount value\n",
"for num in range(10): #number of times we will go through the whole grid\n", " for i in
range(5): #all the rows\n",
" for j in range(5): #all the columns\n", " \n",
" up_grid = grid[i-1][j] if i > 0 else 0\n",
" down_grid = grid[i+1][j] if i < 4 else 0 \n",
" left_grid = grid[i][j-1] if j > 0 else 0 \n",
" right_grid = grid[i][j+1] if j < 4 else 0 \n",
" all_dirs = [up_grid, down_grid, left_grid, right_grid] \n", "\n", " value=0 \n",
" if i==0 and j==1: # the position of A\n", " value = 10 + Y*grid[4][1]\n",
" elif i==0 and j==3: # the position of B\n", " value = 5 + Y*grid[2][3]\n",
" else:\n",
" for direc in all_dirs:\n", " if direc != 0: \n",
" value += .25 * (0 + Y*direc) #if we don't go out of the grid\n", " else:\n",
" value += .25 * (-1 + Y*grid[i][j]) #if we go out of the grid\n", "
\n",

" grid[i][j] = value \n"


],
"execution_count": 0, "outputs": []
},
{
"cell_type": "code", "metadata": {
"id": "svU5dUsswS6z", "colab_type": "code",
"outputId": "87e761bf-375e-42dc-a38d-b39627f71b65", "colab": {
"base_uri": "https://localhost:8080/", "height": 104

21
}
},
"source": [ "np.round(grid, 1)"
],
"execution_count": 3, "outputs": [
{
"output_type": "execute_result", "data": {
"text/plain": [
"array([[ 3.3, 8.8, 4.4, 5.3, 1.5],\n",
" [ 1.5, 3. , 2.2, 1.9, 0.5],\n",
" [ 0. , 0.7, 0.7, 0.4, -0.4],\n",
" [-1. , -0.4, -0.3, -0.6, -1.2],\n",
" [-1.9, -1.3, -1.2, -1.4, -1.9]])"
]
},
"metadata": {
"tags": []
},
"execution_count": 3
}
]
},
{
"cell_type": "code", "metadata": {
"id": "DQZUbYefdPr1", "colab_type": "code", "colab": {}
},
"source": [ ""
],
"execution_count": 0, "outputs": []
]

OUTPUT:-

22

You might also like