0% found this document useful (0 votes)
2 views16 pages

Python Programs

The document contains a series of Python programming exercises aimed at 10th-grade students. Each exercise includes a specific task, such as calculating areas, checking eligibility to vote, or finding prime numbers, along with the corresponding code snippets. The exercises are designed to enhance programming skills and understanding of basic algorithms.

Uploaded by

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

Python Programs

The document contains a series of Python programming exercises aimed at 10th-grade students. Each exercise includes a specific task, such as calculating areas, checking eligibility to vote, or finding prime numbers, along with the corresponding code snippets. The exercises are designed to enhance programming skills and understanding of basic algorithms.

Uploaded by

Delisha Jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1 | Page

CA.I CBSE PRACTICAL


NAME-DELISHA JAIN
CLASS-10TH C
ROLL NO.8

Input a welcome message and display it.


message = input("Enter a welcome message: ")
print("Your message:", message)

Delisha Jain , X-c


2 | Page

Input two numbers and display the larger / smaller number.


a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Larger number:", max(a, b))
print("Smaller number:", min(a, b))

Delisha Jain , X-c


3 | Page

Input three numbers and display the largest / smallest number.


a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
print("Largest number:", max(a, b, c))
print("Smallest number:", min(a, b, c))

Delisha Jain , X-c


4 | Page

Write a program to calculate the surface area and volume of cuboid.


l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
h = float(input("Enter height: "))
surface_area = 2 * (l*b + b*h + h*l)
volume = l * b * h
print("Surface Area:", surface_area)
print("Volume:", volume)

Delisha Jain , X-c


5 | Page

Write a program to check whether the applicant is eligible to vote in the


elections or not.
age = int(input("Enter your age: "))
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")

Delisha Jain , X-c


6 | Page

Write a program to print sum of all the numbers between 1 to 1000.


total = sum(range(1, 1001))
print("Sum from 1 to 1000 is:", total)

Delisha Jain , X-c


7 | Page

Write a Python program that takes 3 numbers as input from the user and
find their average.
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
c = float(input("Enter third number: "))
average = (a + b + c) / 3
print("Average:", average)

Delisha Jain , X-c


8 | Page

Write a program to take a number from the user and check whether it is a
prime number or not.
num = int(input("Enter a number: "))
if num > 1:
for i in range(2, int(num**0.5)+1):
if num % i == 0:
print(num, "is not a prime number.")
break
else:
print(num, "is a prime number.")
else:
print(num, "is not a prime number.")

Delisha Jain , X-c


9 | Page

Write a program to find numbers that are divisible by 7 and multiples of


five between 1200 and 2200.
for i in range(1200, 2201):
if i % 7 == 0 and i % 5 == 0:
print(i, end=" ")

Delisha Jain , X-c


10 | P a g e

Delisha Jain , X-c


11 | P a g e

Write a program to calculate the area and perimeter of a triangle.


a = float(input("Enter side a: "))
b = float(input("Enter side b: "))
c = float(input("Enter side c: "))
s = (a + b + c) / 2
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
perimeter = a + b + c
print("Area:", area)
print("Perimeter:", perimeter)

Delisha Jain , X-c


12 | P a g e

Write a program to input the name, age, and basic salary of an employee.
Calculate the total salary of an employee by adding 10% DA and 10% HRA
to the basic salary.
name = input("Enter name: ")
age = int(input("Enter age: "))
basic = float(input("Enter basic salary: "))
da = 0.10 * basic
hra = 0.10 * basic
total_salary = basic + da + hra
print("Total Salary:", total_salary)

Delisha Jain , X-c


13 | P a g e

Program to check a number entered by the user is positive or negative.


num = float(input("Enter a number: "))
if num > 0:
print("Positive number")
elif num < 0:
print("Negative number")
else:
print("Zero")

Delisha Jain , X-c


14 | P a g e

Write a program to take the temperatures of all seven days of the week
and display the average temperature of that week.
d1 = float(input("Enter Sunday Temperature: "))

d2 = float(input("Enter Monday Temperature: "))

d3 = float(input("Enter Tuesday Temperature: "))

d4 = float(input("Enter Wednesday Temperature: "))

d5 = float(input("Enter Thursday Temperature: "))

d6 = float(input("Enter Friday Temperature: "))

d7 = float(input("Enter Saturday Temperature: "))

avg = (d1 + d2 + d3 + d4 + d5 + d6 + d7) / 7

print("Average Temperature =", avg)

Delisha Jain , X-c


15 | P a g e

Write a Python program that checks whether the number input from the
user is a palindrome or not.
val = input("Enter a number: ")
if val == val[::-1]:
print("Palindrome")
else:
print("Not a Palindrome")

Delisha Jain , X-c


16 | P a g e

Write a program to delete an element from a list.


lst = [10, 20, 30, 40, 50]
element = int(input("Enter element to delete: "))
if element in lst:
[Link](element)
print("Updated List:", lst)
else:
print("Element not found in the list.")

Delisha Jain , X-c

You might also like