Ad Code

Responsive Advertisement

PYTHON

Python Practical Questions


🔹 Basic Python

  1. Print "Hello, World!" in Python.
  2. Add two numbers using Python.
  3. Swap two variables.
  4. Check if a number is even or odd.
  5. Check if a number is prime.
  6. Find the largest of three numbers.
  7. Calculate the factorial of a number.
  8. Print Fibonacci series up to n terms.
  9. Find the sum of all digits in a number.
  10. Check if a string is a palindrome.
  11. Count occurrences of a character in a string.
  12. Reverse a string without using slicing.
  13. Convert Celsius to Fahrenheit.
  14. Find the square root of a number.
  15. Check whether a given number is an Armstrong number.

🔹 If-Else Based Questions (Intermediate to Advanced)

  1. Check if a number is prime or composite.
  2. Determine whether a string is an anagram of another string.
  3. Implement a program to validate a password based on complexity rules.
  4. Check if a given year is a leap year.
  5. Write a program to categorize a person's BMI.
  6. Determine whether a number is a palindrome.
  7. Classify a triangle based on its sides.
  8. Check whether a character is an uppercase letter, lowercase letter, digit, or special symbol.
  9. Implement a grading system based on marks.
  10. Develop a simple login system with username and password validation.
  11. Check if a number is an Armstrong number.
  12. Write a program to classify age groups (child, teen, adult, senior).
  13. Check if a given number is a perfect square.
  14. Determine the type of day (weekday or weekend) based on user input.
  15. Develop a program to check voting eligibility.
  16. Implement a traffic light simulation using if-else statements.
  17. Simulate an ATM withdrawal system with balance validation.
  18. Check if a number is divisible by both 3 and 7.
  19. Determine if a string is a valid email format.
  20. Write a program to determine whether a given time falls in AM or PM.
  21. Develop a medical diagnosis system based on symptom input.
  22. Check if a given username follows length and character constraints.
  23. Write a program to validate a credit card number.
  24. Determine the quadrant of a given coordinate point.
  25. Check if a given number is a Fibonacci number.
  26. Simulate a movie ticket booking system with age-based discounts.
  27. Determine if a number is part of a geometric series.
  28. Write a program to classify a letter grade based on a numerical score.
  29. Simulate an online shopping cart with discount rules.
  30. Check if two numbers are co-prime.
  31. Determine if a given number is an abundant number.
  32. Develop a loan eligibility checker based on income and credit score.
  33. Write a program to determine the winner in a rock-paper-scissors game.
  34. Check if a word contains all vowels at least once.
  35. Determine the shipping cost based on weight and distance.
  36. Implement a student attendance tracker and classify them as regular or irregular.
  37. Write a program to determine salary increments based on performance rating.
  38. Check if a given mobile number follows a valid format.
  39. Simulate a temperature converter with unit validation.
  40. Write a program to validate a strong password (length, uppercase, lowercase, digits, special characters).
  41. Determine the tax slab based on income.
  42. Check if a date falls on a public holiday.
  43. Develop a system to classify books based on genre and author.
  44. Implement an email spam filter based on keyword detection.
  45. Check if a vehicle's registration number follows standard rules.
  46. Write a program to determine the most frequent character in a string.
  47. Simulate a bank account transaction with deposit and withdrawal conditions.
  48. Determine whether a given list is sorted in ascending or descending order.
  49. Write a program to check if an IP address follows valid format rules.

🔹 Lists & Tuples

  1. Find the largest number in a list.
  2. Find the second largest number in a list.
  3. Count occurrences of an element in a list.
  4. Find the sum of all elements in a list.
  5. Remove duplicates from a list.
  6. Check if a list is sorted in ascending order.
  7. Merge two lists and sort them.
  8. Find the common elements in two lists.
  9. Remove all even numbers from a list.
  10. Find the length of a tuple.
  11. Find the maximum and minimum elements in a tuple.
  12. Reverse a tuple.
  13. Convert a tuple into a list.
  14. Create a nested tuple and access elements from it.
  15. Count the occurrences of an element in a tuple.

🔹 List-Based Questions

  1. Create a list of integers and find the sum of all its elements.
  2. Find the largest and smallest numbers in a list.
  3. Reverse a given list without using the reverse() method.
  4. Count the occurrences of a specific element in a list.
  5. Find the second largest number in a list.
  6. Remove duplicates from a list without using a set.
  7. Merge two lists into one without using built-in functions.
  8. Create a list comprehension that generates all even numbers between 1 and 100.
  9. Sort a list of strings in alphabetical order.
  10. Find the common elements between two lists.
  11. Remove all occurrences of a specific element from a list.
  12. Rotate a list by n positions.
  13. Convert a list of strings into a single string, separated by commas.
  14. Check if a list is a palindrome.
  15. Flatten a nested list (e.g., [[1, 2], [3, 4]] → [1, 2, 3, 4]).
  16. Find the difference between the largest and smallest elements in a list.
  17. Find all subsets of a list.
  18. Create a list of the first n Fibonacci numbers.
  19. Filter all prime numbers from a list.
  20. Split a list into chunks of size n.

🔹 Dictionaries & Sets

  1. Create a dictionary and print its keys and values.
  2. Update a dictionary with another dictionary.
  3. Remove a key from a dictionary.
  4. Check if a key exists in a dictionary.
  5. Find the maximum and minimum value in a dictionary.
  6. Find the sum of all values in a dictionary.
  7. Merge two dictionaries.
  8. Create a set and perform union and intersection operations.
  9. Remove an element from a set.
  10. Check if a set is a subset of another set.

🔹 Dictionary-Based Questions

  1. Create a dictionary from two lists: one for keys and one for values.
  2. Merge two dictionaries into one.
  3. Count the frequency of characters in a string using a dictionary.
  4. Find the key with the maximum value in a dictionary.
  5. Check if a specific key exists in a dictionary.
  6. Invert a dictionary (keys become values and vice versa).
  7. Remove a key-value pair from a dictionary by key.
  8. Sort a dictionary by its keys.
  9. Sort a dictionary by its values.
  10. Create a nested dictionary to store student data (name, age, grade).
  11. Update the value of a specific key in a dictionary.
  12. Combine two dictionaries, adding values for common keys.
  13. Create a dictionary of squares for numbers from 1 to 10.
  14. Remove duplicates from a dictionary.
  15. Access and modify a value in a nested dictionary.
  16. Check if two dictionaries are identical.
  17. Convert a dictionary into two lists: one for keys and one for values.
  18. Create a dictionary comprehension to map numbers to their cubes.
  19. Find the sum of all values in a dictionary.
  20. Delete keys with a specific value from a dictionary.

🔹 Loops & Functions

  1. Write a function to calculate the sum of numbers from 1 to n.
  2. Write a function to find the factorial of a number.
  3. Write a function to check if a number is even or odd.
  4. Write a function to count the number of vowels in a string.
  5. Write a function to find the greatest common divisor (GCD) of two numbers.
  6. Write a function to find the least common multiple (LCM) of two numbers.
  7. Write a function to calculate the power of a number without using **.
  8. Write a function to check if a number is a perfect square.
  9. Write a function to check if a number is a perfect cube.
  10. Generate a multiplication table of a number using loops.
  11. Print the reverse of a number using loops.
  12. Print all prime numbers in a given range using loops.
  13. Calculate the sum of digits of a number using loops.
  14. Find the sum of even numbers between 1 and n using loops.
  15. Find the product of all odd numbers between 1 and n using loops.

Post a Comment

0 Comments