JSS Academy of Technical Education
Department: Computer Science and Engineering
Introduction to python programming [BPLCK205B]
Faculty: K S Rajeshwari Semester /Section: II CSEP3
List of Sample Programs
1. Develop a python program using switch case to print the Basic Salary
according to the Job Band (Declare Job Band as char variable). The details
are as follows:
JobBand Basic Salary(InIndian Rupees)
A 10,000
B 15,000
C 35,000
D 50,000
2. Develop a python program to check whether a given year is leap year or
not. Note: There are two conditions for leap year: 1- If year is divisible by
400 (for Century years), 2- If year is divisible by 4 and must not be
divisible by 100 (for Non Century years).
3. Develop a python program to find the factorial of a number using function.
4. Develop a python program to find sum of n natural numbers.
5. Develop a python program to find out the sum of series 12 + 22 + …. + n2.
6. Develop a python program to find greatest of three numbers using user-
defined function.
7. Develop a python program to find length of the string without using function.
8. Develop a python program to find length of the string without using built-in
function.
9. Develop a python program to find reverse of a string using function..
10. Develop a python program to check whether given number is Armstrong
number or not.
11. Develop a python program to check whether given number is perfect square
or not.
12. Develop a python program to find count number of vowels and
consonants in a given string.
13. Develop a python program to find GCD and LCM of two numbers.
14. Develop a python program to input marks (Maximum is 100, Minimum is
0) of five subjects physics, chemistry, electronics, mathematics and
computers.
Calculate percentage and grade according to given conditions:
If percentage >=90% : Grade A
If percentage >=80% : Grade B
If percentage >=70% : Grade C
If percentage >=60% : Grade D
If percentage >=40% : Grade E
If percentage < 40% : Grade F
15. Develop a python program to compute the roots of a quadratic equation by
accepting the coefficients. Print appropriate messages.
16. Develop a python program that takes from user an arithmetic operator [+,-
,*,/] and two operands. Perform corresponding arithmetic operation on the
operands using elif statement.
17. Develop a python program to print fibonacci series up to n terms.
18. Develop a python program to reverse the given number and check
whether it is palindrome or not.
19. Develop a python program to check whether the given number is prime or
not.
20. An electricity board charges the following rates for the use of electricity: for
the first 200 units 80 paisa per unit: for the next 100 units 90 paisa per unit:
beyond 300 units Rs. 1 per unit. All users are charged a minimum of Rs. 100
as meter charge. If the total amount is more than 400, then an additional
surcharge of 15% of total amount is charged. Develop a python program to
read the name of the user, number of units consumed and print out the
charges.
21. Develop a python program to find the value of sum where
sum=1+1/2x+1/3x2+1/4x3+.......1/nxn-1.
22. Compound Interest Calculator
Develop a Python program to calculate the compound interest for a given
principal amount, interest rate, and time period. Use the formula:
A=P(1+n/r)nt
Where:
A = Final amount
P = Principal amount
r = Annual interest rate (in decimal form)
n = Number of times interest is compounded per year
t = Number of years
23. Develop a python program to swap the two numbers using swap().
24. Develop a python program to generate prime numbers between the given
range using function.
25. Develop a python program to find sum of first n numbers using function.
26. Develop a Python program to calculate the compound interest for a given
principal amount, interest rate, and time period.
27. Create a Python program to generate a multiplication table for a given
number up to a specified range.
38. Write a Python program to convert a decimal number to its binary, octal,
and hexadecimal equivalents.
29. Develop a Python program to find the longest word in a given sentence
without using built-in functions.
30. Create a Python program to implement a simple calculator that can perform
addition, subtraction, multiplication, and division operations on two numbers
using functions.
31. Write a Python program to check if a given string is a pangram (contains all
letters of the alphabet).
32. Develop a Python program to find the median of a list of numbers.
33. Create a Python program to generate a random password of a specified
length, including uppercase letters, lowercase letters, numbers, and special
characters.
34. Write a Python program to implement a basic Caesar cipher encryption and
decryption for a given string and shift value. (HELLO ciphers to IFMPP.