0% found this document useful (0 votes)
14 views

10th Practical Program(24 25)1 8

The document outlines a practical program for Class X students at Agurchand Manmull Jain School, focusing on Artificial Intelligence. It includes eight programming exercises with aims, code, and results, covering topics such as Armstrong numbers, pattern generation, list manipulation, and dictionary creation. Each program is successfully executed and demonstrates fundamental programming concepts in Python.

Uploaded by

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

10th Practical Program(24 25)1 8

The document outlines a practical program for Class X students at Agurchand Manmull Jain School, focusing on Artificial Intelligence. It includes eight programming exercises with aims, code, and results, covering topics such as Armstrong numbers, pattern generation, list manipulation, and dictionary creation. Each program is successfully executed and demonstrates fundamental programming concepts in Python.

Uploaded by

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

AGURCHAND MANMULL JAIN SCHOOL

Meenambakkam, Chennai -600 061. (CBSE Affiliation No: 1930733)

PRACTIAL PROGRAM(2024-25)

CLASS: X SUB:ARTIFICIAL INTELLIGENCE(417)

Program 1: Number is Armstrong or not.


Aim: To write a program to check whether the entered number is Armstrong or
not.
Code:
# Python program to check if the number is an Armstrong number or not.
# take input from the user
num = int(input("Enter a number: "))
# initialize sum
sum = 0
# find the sum of the cube of each digit
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
# display the result
if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")
Result: Thus, the program has been executed successfully.
Program 2: Pattern
Aim: To write a program to generate the following pattern:
1

2 3

4 5 6

7 8 9 10

11 12 13 14 15
Code:
#Take input for n lines
n=int(input("Enter n:"))
#Generating Pattern
k=1
for i in range(1,n+1):
for j in range(1,i+1):
print(k,end=" ")
k=k+1
print()

Result: Thus, the program has been executed successfully.


Program 3: Create a List of students
Aim: To write a program to create a list of students' marks with user-defined values
and find the maximum.
Code:
#Take input for n lines
n=int(input("Enter no. of subjects:"))
#Creating empty list
list=[]
#Accepting marks and appending marks into the list
for i in range(n):
m=int(input("Enter marks:"))
list.append(m)
print("Maximum marks scored:",max(list))

Result: Thus, the program has been executed successfully.

Program 4: Sorting List in Numerical Order.

Aim: Write a program for Sorting List in Numerical Order.

Code:

numbers = [1, 3, 4, 2]
# Sorting list of Integers in ascending
numbers.sort()
print(numbers)

Result: Thus, the program has been executed successfully.


Program 5: Even number in a list.
Aim: Write a program to print even numbers in a list

Code:
list1 = [10, 21, 4, 45, 66, 93]
for num in list1:
if num % 2 == 0:
print(num, end=" ")
Result: Thus, the program has been executed successfully.

Program 6: every item of a list into its square.

Aim: Write a program to turn every item of a list into its square

Code:
numbers = [1, 2, 3, 4, 5, 6, 7]
# result list
res = []
for i in numbers:
# calculate square and add to the result list
res.append(i * i)
print(res)

Result: Thus, the program has been executed successfully.


Program 7:adding, removing elements in the list

Aim: Write a program for adding, removing elements in the list

Code:
list = [10, 20, 30, "New Delhi", "Mumbai"]
# printing list
print ("List elements are: ", list)
# adding elements
list.append (40)
list.append (50)
list.append ("Chennai")
# printing list after adding elements
print ("List elements: ", list)
# removing elements
list.pop () ;
# printing list
print("List elements: ", list)
# removing elements
list.pop () ;
# printing list
print ("List elements: ", list)

Result: Thus, the program has been executed successfully.


Program 8:Write a program to create a dictionary.

Aim: Write a program to create a dictionary.

Code:

# creating dictionary
person = {"name": "Priya", "age": 18, "address": "Delhi", "phone number": "5575-1234"}
# printing dictionary
print(person)

Result: Thus, the program has been executed successfully.

You might also like