0% found this document useful (0 votes)
11 views4 pages

Python Programs

The document provides a list of Python programs suitable for Class XI students studying Artificial Intelligence. It includes various programs that cover topics such as calculating simple interest, checking even or odd numbers, finding the largest of two numbers, and more. Additionally, it introduces concepts like lists, dictionaries, and tuples in Python.

Uploaded by

gargkrishna8665
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)
11 views4 pages

Python Programs

The document provides a list of Python programs suitable for Class XI students studying Artificial Intelligence. It includes various programs that cover topics such as calculating simple interest, checking even or odd numbers, finding the largest of two numbers, and more. Additionally, it introduces concepts like lists, dictionaries, and tuples in Python.

Uploaded by

gargkrishna8665
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/ 4

Program List

Class XI
Artificial Intelligence

Python Programs

1. Program to calculate simple interest


p = float(input("Enter Principal: "))
r = float(input("Enter Rate of Interest: "))
t = float(input("Enter Time in years: "))
si = (p * r * t) / 100
print("Simple Interest =", si)
2. Program to check if a number is even or odd
num = int(input("Enter a number: "))
if num % 2 == 0:
print(num, "is Even")
else:
print(num, "is Odd")
3. Program to find the largest between two numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
if a > b:
print("a is larger")
else:
print("b is larger")
4. Program to find the area of a circle

r = float(input("Enter radius of circle: "))


pi=3.14
area = pi * r * r
print("Area of circle =", area)
5. Program to check if number is positive or negative
num = int(input("Enter a number: "))
if num > 0:
print("Positive Number")
elif num < 0:
print("Negative Number")
else:
print("Zero")
6. Program to calculate total price and average of five items
item1 = float(input("Enter price of item 1: "))

item2 = float(input("Enter price of item 2: "))

item3 = float(input("Enter price of item 3: "))

item4 = float(input("Enter price of item 4: "))

item5 = float(input("Enter price of item 5: "))

total = item1 + item2 + item3 + item4 + item5

average = total / 5

print("Total Price =", total)

print("Average Price =", average)


8. Program to check voting eligibility
age = int(input("Enter your age: "))
if age >= 18:
print("Eligible to Vote")
else:
print("Not Eligible to Vote")

7. Program to find Grade of a Student


marks = float(input("Enter marks of the student: "))

if marks >= 90:


grade = "A"
elif marks >= 75:
grade = "B"
elif marks >= 60:
grade = "C"
else:
grade = "D"

print("Grade =", grade)


8. Program to print numbers from 1 to 10
for i in range(1, 11):
print(i)
9. Program to print numbers from 10 to 1
for i in range(10, 0, -1):
print(i)
10. Program to print table of a number
num = int(input("Enter a number: "))
pirnt("Table of ",num)
for i in range(1, 11):
print(num * i)
11. Program to store seven fruits in a list
fruits = []
for i in range(7):
fruit = input(f"Enter fruit {i+1}: ")
fruits.append(fruit)

print("Fruits List:", fruits)


12. Program to create a dictionary (word meaning)

dictionary = {

"Happy": "Feeling good or pleased",

"Brave": "Ready to face danger",

"Fast": "Moving quickly",

print("Dictionary of words and meanings:",dictionary)

13. Program to demonstrate use of Tuple


colors = ("Red", "Green", "Blue", "Yellow")

print("Tuple Elements:", colors)


print("First element:", colors[0])
print("Last element:", colors[-1])
print("Length of tuple:", len(colors))

# Tuples are immutable


# colors[0] = "Black" # This will cause an error

You might also like