0% found this document useful (0 votes)
14 views

Programs List

List of 30 Python programs for Class XI

Uploaded by

SUTAPA RAHA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Programs List

List of 30 Python programs for Class XI

Uploaded by

SUTAPA RAHA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Programs List

Write Python Programs to accept:


1. Write Python Programs to accept age and check whether the person is eligible for vote or
not.
Sol:
age=int(input(‘Enter your age : ‘))
if age>=18:
print(‘You are eligible for voting’)
else:
print(‘You are not eligible for voting’)
2. Write Python Programs to accept a number and check whether the number is even or
odd.
Sol:
num=int(input(‘Enter any number: ‘))
if num%2==0:
print(num,’ is even’)
else:
print(num,’ is odd’)
3. Write Python Programs to accept a number and check whether a number is negative,
positive or zero.
Sol:
num=int(input(‘Enter any number: ‘))
if num>0:
print(num,’ is positive’)
elif num<0:
print(num,’ is negative’)
else:
print(num,’ is equal to zero’)
4. Write Python Programs to accept two numbers and find greater one.
Sol:
num1=int(input(‘Enter any number: ‘))
num2=int(input(‘Enter the second number: ‘))
if num1>num2:
print(num1,’ is greater’)
elif num1<num2:
print(num2,’ is greater’)
else:
print(‘ Both are zero’)
5. Write Python Programs to accept three numbers and find the greatest one.
Sol:
num1=int(input(‘Enter any number: ‘))
num2=int(input(‘Enter the second number: ‘))
num3=int(input(‘Enter the third number: ‘))
if num1>=num2 and num1>=num3:
print(num1,’ is greater’)
elif num2>=num1 and num2>=num3:
print(num2,’ is greater’)
else:
print(num3,’ is greater’)
6. Write Python Programs to accept three sides of a triangle and check whether the triangle
is equilateral, isosceles or scalene triangle.
Sol.
a = float(input("Enter the length of the first side of a triangle: "))
b = float(input("Enter the length of the second side of a triangle: "))
c = float(input("Enter the length of the third side of a triangle: "))
if (a == b and b == c and c == a):
print("Equilateral Triangle.")
elif (a == b or b == c or c == a):
print("Isosceles Triangle.")
elif (a != b and b != c and c != a):
print("Scalene Triangle.")
else:
print("Invalid Input.")
7. Write Python Programs to accept any character and check whether it is alphabet, digit or
special character.
Sol.
ch = input("Please Enter Your Own Character : ")
if ch.isalpha()==True:
print(ch,' is an alphabet')
elif ch.isdigit()==True:
print(ch,' is a digit')
else:
print(ch,' is a special character')
8. Write Python Programs to accept marks of 5 subjects, find the average and grade for
given marks.
Marks Grade
80 - 100 A
60 - 79 B
45 - 59 C
33 - 44 D
Below 33 E
Sol.

9. Write Python Programs to accept the radius and calculate circumference of the circle.
Sol.
import math
r=float(input(‘Enter the radius of the circle : ‘))
circum=2*math.pi*r
print(circum)
10. Write Python Programs to accept the sides of square and calculate their perimeter.
Sol.
sides=float(input(‘Enter the sides of a square : ‘))
peri=4*sides
print(peri)
11. Write Python Programs to accept principal amount, time and rate of interest and calculate
Simple and Compound interest.
Sol.
12. Write Python Programs to accept cost and Sell Price and find the sale price of an item with
the given cost and discount (%).
Sol.
13. Write Python Programs to accept amount, Period and Interest and calculate EMI.
Sol.
14. Write Python Programs to accept cost of the item and percent charged for GST of that
item and then calculate tax - GST / Income Tax.
Sol.
15. Write Python Programs to accept the value of N and find the sum of squares of the first N
natural numbers.
Sol.
n=int(input(‘Enter the value of N : ‘))
s=0
for i in range(1,n+1):
s=s+(i**2)
print(‘Sum of the squares of the numbers : ‘,s)

16. Write Python Programs to accept the value of N and find the sum of all even and Odd
number from N Numbers.
Sol.
n=int(input(‘Enter the value of N : ‘))
eve, odd=0,0
for i in range(1,n+1):
if i%2==0:
eve=eve+i
else:
odd=odd+i
print(‘Sum of the even numbers : ‘,eve)
print(‘Sum of the odd numbers : ‘,odd)
17. Write Python Programs to accept a number and check whether the given number is
Armstrong or Not.
18. Write Python Programs to accept a number and check whether the given number is
Palindrome or Not.
19. Write Python Programs to accept a number and check whether the given number is Prime
or Not.
20. Write Python Programs to accept a number and print factorial of a given number.
21. Write Python Programs to accept two numbers and find LCM and HCF of 2 numbers.
22. Write Python Programs to accept a list and find the largest and smallest numbers in the
list.
23. Write Python Programs to accept a list and find the third largest/smallest number in a
list.
24. Write Python Programs to accept to print the first ‘n’ multiples of given number.
25. Write Python Programs to accept to count the number of vowels in user entered string.
26. Write Python Programs to accept a string and print the words starting with an alphabet.
27. Write Python Programs to accept a sentence and print the number of occurrences of a
given alphabet in each word.
28. Write Python Programs to accept create a dictionary to store names of states and their
capitals.
29. Write Python Programs to accept create a dictionary of students to store names and
marks obtained in 5 subjects.
30. Write Python Programs to accept to print the highest and lowest values in the dictionary.

You might also like