Programming Questions:
1. Write a Python program to input the principal amount, rate of interest, and time.
Calculate and display the simple interest using the formula:
SI=P×R×T100SI = \frac{P \times R \times T}{100}SI=100P×R×T
Validate the inputs to ensure they are positive numbers.
2. Write a Python program to demonstrate the use of various data types. Perform the
following operations:
o Concatenate two strings.
o Perform addition on integers and floats.
o Create a complex number and display its real and imaginary parts.
o Convert an integer to binary, octal, and hexadecimal formats.
3. Write a Python program that takes two numbers as input and performs the following
operations using operators:
Addition, Subtraction, Multiplication, Division
Floor Division, Modulus, and Exponentiation
Display the results for each operation.
4. Write a Python program to print the Fibonacci series up to n terms using a while loop. Take
n as input.
5. Develop a Python program to check whether a given number is Armstrong or not using a for
loop.
(A number is called Armstrong if the sum of its own digits each raised to the power of the
number of digits is equal to the original number).
6. Write a Python program to accept a list of numbers from the user. Perform the following
operations:
Find the largest and smallest number.
Calculate the sum and average of the list.
Remove duplicates and print the updated list.
7. Create a dictionary to store student names and their marks in three subjects. Perform the
following operations:
Calculate the total marks and percentage for each student.
Display student details with their total marks and percentage.
Find and display the student with the highest marks.
8. Write a Python function called factorial(n) using recursion to calculate the factorial of a
given number. Test the function using user input.
9. (Create a function is_prime(num) that takes a number as input and returns True if it is prime
and False otherwise.
Write a main function to display all prime numbers within a given range.
10. Create a Python class called BankAccount with the following attributes:
Account number, Account holder's name, and Balance.
Implement methods to:
Deposit an amount
Withdraw an amount
Display the account details
11. Write a program demonstrating inheritance. Create a base class Shape with methods to display the
shape name. Derive two classes Circle and Rectangle to calculate and display their areas.
12. Write a Python program to demonstrate exception handling using try, except, else, and
finally.
Handle the following exceptions:
ZeroDivisionError
ValueError
13. Create a Python program to read integers from the user. If a non-integer is entered, raise a custom
exception InvalidInputException with an appropriate error message.
14. Write a Python program to create a text file named "[Link]" and write user-input data to it.
Then read and display the contents of the file.
15. Write a Python program to count the number of words, lines, and characters in a given text
file. Display the results in a clear format.