You are on page 1of 4

Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

ARTIFICIAL INTELLIGENCE DEPARTMENT

Total Marks: 05

Obtained Marks:

ARTIFICIAL
INTELLIGENCE LAB
LAB TASK # 01

Submitted To: Sir Murtaza Mehdi


_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Student Name: Husnain Akbar Khan


______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Reg. Number: 21108110


______________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Ai LAB BSAI-3A SZABIST-ISB


Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

ARTIFICIAL INTELLIGENCE DEPARTMENT

Question 1
Code:
#APPEND
fruits = ["apple", "mango", "cherry"]
fruits.append("banana")
print(fruits)

#EXTEND
fruits = ["apple", "mango", "cherry"]
fruits.extend(["banana", "peach"])
print(fruits)

#INSERT
lis = [2, 1, 3, 5, 3, 8]
lis.insert(3, 4)

print("List elements after inserting 4 are : ", end="")


for i in range(0, len(lis)):
print(lis[i], end=" ")
print("\r")
#REMOVE

lis.remove(3)

print ("List elements after removing are : ", end="")


for i in range(0, len(lis)):
print(lis[i], end=" ")

Output:

Question 2
Code:

Part1:)

Triangle

from turtle import *


shape('triangle')
for i in range(3):

Ai LAB BSAI-3A SZABIST-ISB


Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

ARTIFICIAL INTELLIGENCE DEPARTMENT


forward(150)
left(120)
done()

part2:)

Square:
from turtle import *

drawing_area = Screen()
drawing_area.setup(width=750, height=500)

shape('square')
for i in range(4):
left(90)
forward(150)
done()

part 3):

HEXAGON
from turtle import *

drawing_area = Screen()
drawing_area.setup(width=750, height=500)

shape('square')
for i in range(6):
forward (90)
left (300)

done()

part 4):

OCTAGON
from turtle import *

drawing_area = Screen()
drawing_area.setup(width=750, height=500)

shape('square')
for i in range(8):
forward (100)
left (45)

done()

Output:

Ai LAB BSAI-3A SZABIST-ISB


Shaheed Zulfikar Ali Bhutto Institute of Science & Technology

ARTIFICIAL INTELLIGENCE DEPARTMENT

Question 3
Code:
num = int (input("Enter the number : "))

print ("multiplication Table of " , num)

for i in range(1, 11):

print (num, "x" , i, " = " , num*i)

Output:

Question 4
Code:
List1 = [12, 15, 32, 42, 55, 75, 122, 132, 150, 180, 200]

for i in range(0, len(List1), 1):

if List1[i]<=150:

if List1[i]%5==0:
print(List1[i])

Output:

Ai LAB BSAI-3A SZABIST-ISB

You might also like