0% found this document useful (0 votes)
1 views9 pages

Ai Practicalfile

The document is a project by Devanshi Meena, a student of Class Xth C, acknowledging the guidance of her teacher and principal. It includes several Python programs for various tasks such as calculating net run rate, checking character types, finding maximum numbers, calculating electricity bills, checking Armstrong numbers, and printing multiplication tables. The document concludes with a thank you note.

Uploaded by

dbs6hgf6ht
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)
1 views9 pages

Ai Practicalfile

The document is a project by Devanshi Meena, a student of Class Xth C, acknowledging the guidance of her teacher and principal. It includes several Python programs for various tasks such as calculating net run rate, checking character types, finding maximum numbers, calculating electricity bills, checking Armstrong numbers, and printing multiplication tables. The document concludes with a thank you note.

Uploaded by

dbs6hgf6ht
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/ 9

Artificial

Intelligence

Name: DEVANSHI MEENA

Class: Xth C

Roll Number: 10309


ACKNOWLEDGEMENT

I wish to express my deep sense of


gratitude
and indebtedness to our learned
teacher MR. AJIT KUSHWAHA , TGT,
K.V.
BHANDUPSHIFT-1 for his invaluable
help, advice and guidance in the
preparation of this project.
I am also greatly indebted to our
principal
MR. A.C. RAJPUT and school authorities
for providing me with the facilities
requisite
laboratory conditions for making this
practical file.
I also extend my thanks to a number of
teachers, my classmates and friends
who helped me to complete this
practical file successfully.
A program to compute the net
run rate for a tournament.

def calculate_nrr(total_runs_scored,
total_overs_faced, total_runs_conceded,
total_overs_bowled):
# Calculate NRR
batting_rate = total_runs_scored / total_overs_faced
bowling_rate = total_runs_conceded /
total_overs_bowled
nrr = batting_rate - bowling_rate
return nrr
# Example inputs for a team
total_runs_scored = float(input("Enter the total runs
scored by the team: "))
total_overs_faced = float(input("Enter the total overs
faced by the team: "))
total_runs_conceded = float(input("Enter the total runs
conceded by the team: "))
total_overs_bowled = float(input("Enter the total overs
bowled by the team: "))
# Calculate NRR
nrr = calculate_nrr(total_runs_scored,
total_overs_faced, total_runs_conceded,
total_overs_bowled)
# Output the result
print(f"The Net Run Rate (NRR) of the team is: {nrr:.2f}")
A program to check whether the given
character is an uppercase letter or
lowercase letter or a digit or a special
character.

def check_character(char):
# Check if the character is an uppercase letter
if char.isupper():
return "Uppercase letter"
# Check if the character is a lowercase letter
elif char.islower():
return "Lowercase letter"
# Check if the character is a digit
elif char.isdigit():
return "Digit"
# If it's none of the above, it's a special character
else:
return "Special character"
# Take input from the user
char = input("Enter a character: ")
# Ensure that only one character is entered
if len(char) == 1:
result = check_character(char)
print(f"The character '{char}' is a {result}.")
else:
print("Please enter exactly one character.")
A program to find the maximum
number out of the given three
numbers.

def find_maximum(num1, num2, num3):


if num1 >= num2 and num1 >= num3:
return num1
elif num2 >= num1 and num2 >= num3:
return num2
else:
return num3
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))
num3 = float(input("Enter the third number: "))
maximum = find_maximum(num1, num2, num3)
print(f"The maximum number is: {maximum}")
A program that calculates the
electricity bill based on the given
rate structure.

def calculate_bill(units_consumed):
if units_consumed <= 100:
# Rate for 0-100 units
return units_consumed * 1
elif units_consumed <= 300:
# Rate for 101-300 units
return 100 + (units_consumed - 100) * 1.25
elif units_consumed <= 500:
# Rate for 301-500 units
return 350 + (units_consumed - 300) * 1.50
else:
# Rate for 500+ units
return 650 + (units_consumed - 500) * 1.75
# Input: customer number and power consumed
customer_number = input("Enter customer number: ")
units_consumed = float(input("Enter units of power
consumed: "))
# Calculate the bill amount
amount = calc
A a program to check whether the
entered number is Armstrong or
not.

def is_armstrong(number):
# Convert the number to a string to easily extract
digits
num_str = str(number)
num_digits = len(num_str)
# Calculate the sum of the digits raised to the power
of the number of digits
sum_of_powers = sum(int(digit) ** num_digits for
digit in num_str)
# Check if the sum of powers equals the original
number
return sum_of_powers == number
# Input: number from the user
num = int(input("Enter a number to check if it's an
Armstrong number: "))
# Check if the number is an Armstrong number
if is_armstrong(num):
print(f"{num} is an Armstrong number.")
else:
print(f"{num} is not an Armstrong number.")
A a program to print a
multiplication table of the entered
number

def print_multiplication_table(number, limit=10):


# Print the multiplication table up to the specified
limit (default is 10)
for i in range(1, limit + 1):
print(f"{number} x {i} = {number * i}")
# Input: number from the user
num = int(input("Enter a number to print its
multiplication table: "))
# Call the function to print the multiplication table
print_multiplication_table(num)
Thank you!

Name: DEVANSHI MEENA

Class: Xth C

Roll Number: 10309

You might also like