🎓 Get Full Quality Study Materials & Lab Manuals — Follow our blog using the button below!  |  📺 Subscribe our YouTube Channel "Lectures by Ravula Govardhan" for Programming Contents!  | 
● NEW Experiment 1 to 13 Full Stack Development Lab Programs available Read it here →
“ఈ రోజు నేర్చుకున్న చిన్న విషయం, రేపటి పెద్ద విజయానికి పునాది.”

Python Programs List – 100+ Practice Questions

Top 100+ Python Interview & Practice Questions

A complete list of Python programming questions covering Operators, Conditional Statements, Loops, Functions, Lists, Sets, Strings, Tuples, Dictionaries, OOP, and Exception Handling.

Operators

  1. Write a program to swap two numbers using bitwise XOR.
  2. Implement a calculator using arithmetic operators (+, -, *, /, %).
  3. Find whether a number is even or odd using bitwise operators.
  4. Implement a program to check if two numbers are equal without using comparison operators (== or !=).
  5. Find the remainder without using the modulo (%) operator.
  6. Write a program to check if a number is a power of 2 using bitwise operators.
  7. Use ternary operators to find the maximum of three numbers.
  8. Implement a program to count the number of 1s in a binary representation of a number.
  9. Write a program to swap two numbers without using a third variable.
  10. Use logical operators to check if a number is within a given range.

Conditional Statements

  1. Check whether a given year is a leap year or not.
  2. Write a program to determine if a number is positive, negative, or zero.
  3. Find the greatest of three numbers using nested if statements.
  4. Implement a grading system where marks are input, and the program prints grades accordingly.
  5. Write a menu-driven program for a simple calculator using if-elif.
  6. Check if a character is a vowel or consonant.
  7. Determine whether a triangle is equilateral, isosceles, or scalene based on given sides.
  8. Write a program to find whether a number is divisible by both 3 and 5.
  9. Implement a simple ATM withdrawal system with conditions.
  10. Check whether a number is prime or not using conditional statements.

Looping Statements

  1. Print the Fibonacci series up to n terms.
  2. Print all prime numbers within a given range.
  3. Write a program to reverse a number.
  4. Print a multiplication table of a given number.
  5. Find the sum of digits of a given number.
  6. Write a program to check if a number is an Armstrong number.
  7. Count the number of vowels and consonants in a string.
  8. Print a pattern like a pyramid using nested loops.
  9. Find the factorial of a number using a loop.
  10. Implement a number guessing game using a loop.

Functions

  1. Write a function to calculate the factorial of a number.
  2. Implement a function to check if a number is prime.
  3. Write a function to find the largest of three numbers.
  4. Create a recursive function to compute the nth Fibonacci number.
  5. Write a function to count the occurrences of a character in a string.
  6. Implement a function to return the sum of all elements in a list.
  7. Write a function to check if a string is a palindrome.
  8. Implement a function to find the LCM of two numbers.
  9. Write a function to check if a number is an Armstrong number.
  10. Implement a lambda function to find the square of a number.

Lists

  1. Write a program to find the maximum and minimum elements in a list.
  2. Remove duplicate elements from a list.
  3. Find the sum of all elements in a list.
  4. Sort a list without using built-in functions.
  5. Reverse a list using slicing.
  6. Merge two sorted lists into a single sorted list.
  7. Write a program to rotate a list n times.
  8. Find the second largest element in a list.
  9. Implement a program to count the frequency of elements in a list.
  10. Remove all occurrences of a given element from a list.

Sets

  1. Write a program to find the union and intersection of two sets.
  2. Remove duplicates from a list using sets.
  3. Check if one set is a subset of another.
  4. Find the difference between two sets.
  5. Create a set from a string and print unique characters.
  6. Find common elements between three sets.
  7. Convert a list into a set and vice versa.
  8. Remove a specific element from a set.
  9. Write a program to check if two sets have any common elements.
  10. Find the symmetric difference between two sets.

Strings

  1. Reverse a string without using built-in functions.
  2. Count the number of vowels and consonants in a string.
  3. Check if a string is a palindrome.
  4. Find the frequency of each character in a string.
  5. Convert a string to uppercase and lowercase.
  6. Write a program to check if two strings are anagrams.
  7. Remove duplicate characters from a string.
  8. Find the longest word in a sentence.
  9. Replace all spaces in a string with %20.
  10. Find all substrings of a given string.

Tuples

  1. Find the maximum and minimum elements in a tuple.
  2. Convert a list into a tuple and vice versa.
  3. Find the index of an element in a tuple.
  4. Merge two tuples into one.
  5. Write a program to count occurrences of an element in a tuple.
  6. Convert a tuple of strings into a single concatenated string.
  7. Check if an element exists in a tuple.
  8. Find the sum of all elements in a numeric tuple.
  9. Sort a tuple of numbers.
  10. Write a program to convert a tuple into a dictionary.

Dictionary

  1. Write a program to merge two dictionaries.
  2. Find the maximum and minimum values in a dictionary.
  3. Sort a dictionary by its values.
  4. Write a program to check if a key exists in a dictionary.
  5. Count the frequency of words in a sentence using a dictionary.
  6. Write a program to remove a key from a dictionary.
  7. Convert a dictionary into a list of tuples and vice versa.
  8. Find the sum of all values in a dictionary.
  9. Write a program to get the key with the highest value in a dictionary.
  10. Implement a phone book using a dictionary.

OOPs (Object-Oriented Programming)

  1. Write a class representing a student with attributes and methods.
  2. Implement a class for a bank account with deposit and withdrawal functionalities.
  3. Write a Python program to demonstrate method overloading.
  4. Implement a class hierarchy demonstrating inheritance.
  5. Write a program to demonstrate multiple inheritance.
  6. Implement an abstract class in Python.
  7. Write a program demonstrating method overriding.
  8. Implement a program to manage employee records using OOPS.
  9. Write a program to demonstrate operator overloading.
  10. Implement a singleton class in Python.

Exception Handling

  1. Write a program to handle divide-by-zero exceptions.
  2. Implement a program to catch multiple exceptions.
  3. Write a program that raises a ValueError if the input is not a number.
  4. Implement a custom exception class.
  5. Write a program to demonstrate try, except, finally blocks.
  6. Implement exception handling for file handling.
  7. Catch and handle an IndexError.
  8. Write a program to raise a KeyError.
  9. Implement exception handling for type errors.
  10. Demonstrate the use of the else block in exception handling.

Study Notes

  • Attempt each program on your own before checking any reference solution.
  • Write clean, well-commented code and test with edge cases.
  • Practice both iterative and recursive approaches where possible.
  • Follow restrictions in the question (e.g., no built-in functions) carefully.
  • Revise OOP and Exception Handling thoroughly, as they are commonly tested.

Python Programs — Practice Series. Prepared for academic learning purposes.

0 Ravula Kartheek:

Post a Comment