PRESIDENCY SCHOOL BANGALORE NORTH
ARTIFICIAL INTELLIGENCE (417)
PRACTICAL RECORD WORK
Class: X
Instructions: Programming Language to be used is Python
QNO Question
1 Write a program to check whether the given character is an uppercase letter or lowercase letter.
Ans:
ch = input("Please Enter Your Own Character(only one character) : ")
if(ch.isupper()):
print("The Given Character ", ch, "is an Uppercase Alphabet")
elif(ch.islower()):
print("The Given Character ", ch, "is a Lowercase Alphabet")
else:
print("The Given Character ", ch, "is Not an Alphabet")
2 Python program to find the largest number among the three input numbers.
Ans:
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print("The largest number is", largest)
3 Write a program to print a multiplication table of the entered number.
Ans:
num = int(input("Display multiplication table of? "))
# Iterate 10 times from i = 1 to 10
for i in range(1, 11):
print(num, 'x', i, '=', num*i)
4 Write a program to count the frequency of every element/ character in a given list.
Ans:
# initializing the list
list2 = ['A', 'A', 'B', 'C', 'B', 'D', 'D', 'A', 'B']
frequency = { }
for item in list2:
if item in frequency:
frequency[item] += 1
else:
frequency[item] = 1
print(frequency)
Page 1 of 3
5 Write a program to check whether a number is positive, negative orzero.
Ans:
num = float(input("Enter a number: "))
if num > 0:
print(num,"is Positive number")
elif num == 0:
print(num,"is Zero")
else:
print(num,"is Negative number")
6 Write a program to input temperature as Fahrenheit and convert into Celsius.
Note: The Formula is: C=(F-32)*5/9
Ans:
def fahrenheit_to_celsius(fahrenheit):
celsius = (fahrenheit - 32) * 5 / 9
print("Temperature in Celsius:", round(celsius, 3))
# Example usage
fahrenheit = 40
fahrenheit_to_celsius(fahrenheit)
7 Write a program to find Simple interest. Note: The formula is SI=(P*R*T)/100
Ans:
def simple_interest(p,t,r):
print('The principal is', p)
print('The time period is', t)
print('The rate of interest is',r)
si = (p * t * r)/100
print('The Simple Interest is', si)
return si
simple_interest(1000, 6, 3)
8 Write a program to accept percentage from the user and display the grade
according to the following criteria.
Marks grade
>90 A
>80 and <=90 B
>=60 and <=80 C
Below 60 D
Page 2 of 3
Ans:
9 Write a program to accept numbers from 1 to 7 and display the name of the day like
1 for Sunday ,2 for Monday and so on
Ans:
10 Write a program to find total and average of five subject marks.
Ans:
Page 3 of 3