You are on page 1of 21

Gwalior Glory High School

Practical File
Artificial Intelligence
Class X
Session: 2021-22
Submitted By: Submitted To:
Mrs. Ritika Keswani
Name: Ram Kushwah
Rollno: 31
Class: X
Section: D
Certificate
AI For ALL (AI Aware)
Certificate
AI For ALL (AI Appreciate)
INDEX
S.NO. PROGRAM
1. PRINT 5 LINES ABOUT YOURSELF USING PRINT()
FUNCTION
2. WRITE A PYTHON PROGRAM TO MULTIPLY TWO
NUMBERS
3. WRITE A PYTHON PROGRAM TO SWAP TWO VARIABLES
4. WRITE A PROGRAM TO FIND THE AREA OF A
RECTANGLE AND PERIMETER OF A RECTANGLE IN
PYTHON
5. WRITE A PYTHON PROGRAM TO FIND OR CALCULATE
SUM AND AVERAGE OF N NUMBERS
6. WRITE A PYTHON PROGRAM TO COMPUTE COMPOUND
INTEREST
7. WRITE A PYTHON PROGRAM TO FIND LARGEST/
MAXIMUM OF N NUMBERS
8. WRITE A PYTHON PROGRAM TO FIND CUBE OF A
NUMBER
9. WRITE A PYTHON PROGRAM TO CONVERT CELSIUS TO
FAHRENHEIT
10. WRITE A PYTHON PROGRAM TO DISPLAY CALENDAR
11. WRITE A PYTHON PROGRAM TO CHECK LEAP YEAR
12. WRITE A PYTHON PROGRAM TO CHECK VOTING
ELIGIBILITY
13. WRITE A PROGRAM TO CHECK WHETHER A NUMBER IS
EVEN OR NOT.
14. WRITE A PYTHON PROGRAM TO CHECK IF A NUMBER IS
POSITIVE, NEGATIVE OR ZERO.
15. WRITE A PYTHON PROGRAM TO DISPLAY THE
MULTIPLICATION TABLE
Example for Your Reference
WRITE A PYTHON PROGRAM TO PRINT "HELLO PYTHON"
FIVE TIMES.

CODE:

i=1

while i < 6:

print("Hello Python")

i += 1

OUTPUT:

Hello Python
Hello Python
Hello Python
Hello Python Hello Python

1. PRINT 5 LINES ABOUT YOURSELF USING PRINT()


FUNCTION

CODE:

#WAP TO PRINT 5 LINES ABOUT YOURSELF USING PRINT() FUNCTION


print('Introduction')
Name=input('1. My name is ')
Class =input('2. I am studying in class ')
Address=input('3. I live in ')
Hobbies=input('4. My hobbies are ')
Aim=input('5. The aim of my life is to become a ')

OUTPUT

Introduction
1. My name is Ram Kushwah
2. I am studying in class 10th
3. I live in Gwalior
4. My hobbies are dancing and playing video games
5. The aim of my life is to become a ASTRONAUT

2. WRITE A PYTHON PROGRAM TO MULTIPLY TWO


NUMBERS
CODE:
# WAP PROGRAM TO MULTIPLY TWO
NUMBERS
num1=int(input('Enter first number: '))
num2=int(input('Enter second number: '))
M= num1*num2
print('The Multiplication of two numbers is, ',
M)

Output

Enter first number: 99


Enter second number: 99
The Multiplication of two numbers is, 9801
[Program finished]
WRITE A PYTHON PROGRAM TO SWAP TWO VARIABLES
3
CODE:
x = input('Enter value of x: ')
y = input('Enter value of y: ')
temp = x
x=y
y = temp
print('The value of x after swapping:
{}'.format(x))
print('The value of y after swapping:
{}'.format(y))

OUTPUT
Enter value of x: 739
Enter value of y: 884
The value of x after swapping: 884
The value of y after swapping: 739
[Program finished]
4. WRITE A PROGRAM TO FIND THE AREA OF A
RECTANGLE AND PERIMETER OF A RECTANGLE IN
PYTHON

Code:
#wap TO FIND THE AREA OF A RECTANGLE
AND PERIMETER OF A RECTANGLE IN PYTHON
L=int(input('Enter the length of rectangle:'))
B=int(input('Enter the breadth of rectangle:'))
P=2*(L+B)
A=L*B
print('The perimeter of rectangle is, ',P,'cm')
print('The area of rectangle is, ',A,'cm^2')

Output
Enter the length of rectangle:9
Enter the breadth of rectangle:5
The perimeter of rectangle is, 28 cm
The area of rectangle is, 45 cm^2

[Program finished]
5. WRITE A PYTHON PROGRAM TO FIND OR CALCULATE
SUM AND AVERAGE OF N NUMBERS
Code:
n = input("Enter Number to calculate sum and
average")
n = int (n)
totalNo = n
sum=0
while (n >= 0):
sum += n
n-=1
average = sum / totalNo
print ("sum of ", totalNo ,"using while loop ",
sum)
print ("average of", totalNo ,"using while loop
", average)

Output
Enter Number to calculate sum and average 10
sum of 10 using while loop 55
average of 10 using while loop 5.5
[Program finished]
6. WRITE A PYTHON PROGRAM TO COMPUTE COMPOUND
INTEREST

Code:
# WAP TO COMPUTE COMPOUND INTEREST
P=int(input('Enter the principle amount : '))
R=int(input('Enter the rate of interest : '))
n=int(input('Enter the time span : '))
A= P*(1+R/100)**n
CI= A-P
print('The Compound Interest is ',CI,'Rs')

Output:
Enter the principle amount : 90000
Enter the rate of interest : 10
Enter the time span : 2
The Compound Interest is
18900.000000000015 Rs

[Program finished]

7. WRITE A PYTHON PROGRAM TO FIND LARGEST/


MAXIMUM OF N NUMBERS
Code:
lis = []
count = int(input('How many numbers? '))
for n in range(count):
number = int(input('Enter number: '))
lis.append(number)
print("Largest element of the list is :", max(lis))

Output:
How many numbers? 5
Enter number: 66
Enter number: 67
Enter number: 98
Enter number: 97
Enter number: 57
Largest element of the list is : 98

[Program finished]

8. WRITE A PYTHON PROGRAM TO FIND CUBE OF A


NUMBER
Code:
#wap to find cube of a number
A=int(input('Enter the number :'))
Cube= A**3
print('The cube of',A,'is',Cube)

Output:

Enter the number :5


The cube of 5 is 125

[Program finished]

9. WRITE A PYTHON PROGRAM TO CONVERT CELSIUS TO


FAHRENHEIT

Code:
#wap to convert celsius to fahrenheit
C=int(input('Enter the temperature in celsius:
'))
F=9*C/5+32
print('The temperature in fahrenheit is',F)

Output:

Enter the temperature in celsius: 100


The temperature in fahrenheit is 212.0

[Program finished]
10. WRITE A PYTHON PROGRAM TO DISPLAY CALENDAR

Code:
import calendar
yy = int(input("Enter year: "))
mm = int(input("Enter month: "))
# display the calendar
print(calendar.month(yy, mm))

Output:
Enter year: 2022
Enter month: 01
January 2022
Mo Tu We Th Fr Sa Su
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

[Program finished]
11. WRITE A PYTHON PROGRAM TO CHECK LEAP YEAR

Code:
def CheckLeap(Year):
# Checking if the given year is leap year
if((Year % 400 == 0) or
(Year % 100 != 0) and
(Year % 4 == 0)):
print("Given Year is a leap Year");
# Else it is not a leap year
else:
print ("Given Year is not a leap Year")
# Taking an input year from user
Year = int(input("Enter the number: "))
# Printing result
CheckLeap(Year)
Output:
Enter the number: 2000
Given Year is a leap Year
[Program finished]
12. WRITE A PYTHON PROGRAM TO CHECK VOTING
ELIGIBILITY
Code:
#WAP TO CHECK VOTING ELIGIBILITY
Age=int(input('Enter your age :'))
if Age>=18:
print('You are eligible to vote')
else:
print('You are not eligible to vote')

Output:

Enter your age :16


You are not eligible to vote

[Program finished]

13. WRITE A PROGRAM TO CHECK WHETHER A NUMBER IS


EVEN OR NOT.
Code:
# Wap to check a number is even or not.
Num= int(input('Enter the number :'))
if Num%2==0:
print('The number is even')
else:
print('No, the number is not even')

Output:

Enter the number :253568


The number is even

[Program finished]

14. WRITE A PYTHON PROGRAM TO CHECK IF A NUMBER IS


POSITIVE, NEGATIVE OR ZERO.
Code:

#Wap to check if a number is positive ,negative


or zero
Num=int(input('Enter the number :'))
if Num<0:
print('The number is negative')
elif Num==0:
print('The number is zero')
else:
print('The number is positive')

Output:
Enter the number :-6362782
The number is negative

[Program finished]

15. WRITE A PYTHON PROGRAM TO DISPLAY THE


MULTIPLICATION TABLE
Code:
# wap to display the multuplication table
number = int(input ("Enter the number of which
the user wants to print the multiplication table:
"))
print ("The Multiplication Table of: ", number)
for count in range(1, 11):
print (number, 'x', count, '=', number * count)
Output:
Enter the number of which the user wants to
print the multiplication table: 19
The Multiplication Table of: 19
19 x 1 = 19
19 x 2 = 38
19 x 3 = 57
19 x 4 = 76
19 x 5 = 95
19 x 6 = 114
19 x 7 = 133
19 x 8 = 152
19 x 9 = 171
19 x 10 = 190
[Program finished]

You might also like