Skip to content

hasib503/100-Python-Programs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

100 Python Programs

This repository contains a collection of Python programs demonstrating various concepts and solutions. Below is a list of the included programs with links to their respective files:

  1. Add Two Numbers: A program to compute the sum of two user-provided numbers.

  2. Calculate Square Root: A program to compute the square root of a user-provided number using both manual and library methods.

  3. Check Leap Year: A program to determine if a given year is a leap year.

  4. Check Prime Number: A program to check if a given number is prime.

  5. Quiz Game: A simple quiz game that asks the user a question and evaluates their response.

  6. Swap Two Variables: A program to demonstrate two methods for swapping the values of two variables.

  7. Two Sum [LeetCode]: A solution to the LeetCode "Two Sum" problem, which returns the indices of two numbers that add up to a target value.

  8. Delivary Time[Nahid Hasan]:

  9. Devisabe_by_X_not_Y:

  10. Display Calander:

  11. Find ASCII Code:

  12. Sort Words in Alphabetic Order:

  13. Factorial Calculation: Program to calculate the factorial of a number using recursion.

  14. Fibonacci Sequence: Program to generate the Fibonacci sequence up to a given number of terms.

  15. Palindrome Check: Program to check if a string is a palindrome.

  16. Count Vowels in a String: Program to count the number of vowels in a given string.

  17. Reverse a String: Program to reverse the characters of a given string.

  18. Sum of Digits in a Number: Program to calculate the sum of digits in a number.

  19. Check Armstrong Number: Program to check if a number is an Armstrong number.

  20. Binary to Decimal Conversion: Program to convert a binary number into its decimal equivalent.

  21. Decimal to Binary Conversion: Program to convert a decimal number to binary.

  22. GCD of Two Numbers: Program to calculate the greatest common divisor of two numbers.

  23. LCM of Two Numbers: Program to calculate the least common multiple of two numbers.

  24. Find the Largest Element in a List: Program to find the largest element in a given list.

  25. Find the Smallest Element in a List: Program to find the smallest element in a given list.

  26. Find the Sum of Elements in a List: Program to calculate the sum of all elements in a list.

  27. Count Occurrences of a Character in a String: Program to count how many times a character appears in a string.

  28. Find the Length of a List: Program to find the number of elements in a list.

  29. Merge Two Lists: Program to merge two lists into one.

  30. Find the Second Largest Element in a List: Program to find the second largest element in a list.

  31. Check if a String is a Substring: Program to check if one string is a substring of another.

  32. Transpose a Matrix: Program to transpose a given matrix (swap rows and columns).

  33. Matrix Addition: Program to add two matrices element-wise.

  34. Matrix Multiplication: Program to multiply two matrices.

  35. Find the Determinant of a Matrix: Program to compute the determinant of a square matrix.

  36. Find the Trace of a Matrix: Program to calculate the sum of the elements on the main diagonal of a matrix.

  37. Linear Search: Program to implement linear search to find an element in a list.

  38. Binary Search: Program to implement binary search to find an element in a sorted list.

  39. Bubble Sort: Program to implement the bubble sort algorithm.

  40. Insertion Sort: Program to implement the insertion sort algorithm.

  41. Selection Sort: Program to implement the selection sort algorithm.

  42. Quick Sort: Program to implement the quick sort algorithm.

  43. Merge Sort: Program to implement the merge sort algorithm.

  44. Check if a Number is Even or Odd: Program to check whether a number is even or odd.

  45. Find Factorial Using Iteration: Program to find the factorial of a number using loops (non-recursive method).

  46. Sum of Natural Numbers: Program to calculate the sum of the first N natural numbers.

  47. Find the Power of a Number: Program to compute the power of a number (using pow or custom function).

  48. Check if a String is an Anagram: Program to check if two strings are anagrams of each other.

  49. Check Perfect Number: Program to check whether a given number is a perfect number (equal to the sum of its divisors).

  50. Generate Random Numbers: Program to generate random numbers within a specified range using the random module.

  51. Generate Fibonacci Series Using Recursion: Program to generate Fibonacci numbers using recursive function calls.

  52. Check if a Number is a Palindrome: Program to check if a number reads the same forwards and backwards.

  53. Remove Duplicates from a List: Program to remove duplicate elements from a list.

  54. Find the Intersection of Two Lists: Program to find the common elements between two lists.

  55. Find the Union of Two Lists: Program to merge two lists, removing duplicates.

  56. Find the Sum of the Digits in a String: Program to extract digits from a string and calculate their sum.

  57. Check if Two Strings are Rotations of Each Other: Program to check whether one string is a rotation of another string.

  58. Find the Maximum and Minimum of a List Without Using Built-In Functions: Program to find the max and min values in a list without using built-in functions like max() or min().

  59. Flatten a Nested List: Program to flatten a list that contains sublists into a single-level list.

  60. Find the Most Frequent Element in a List: Program to find the element that appears the most times in a list.

  61. Check if a List is Sorted: Program to determine whether a list is already sorted.

  62. Find the Median of a List: Program to calculate the median value of a list of numbers.

  63. Check if a List Contains All Unique Elements: Program to check if all elements in a list are unique.

  64. Generate a Random Password: Program to generate a random password with a specified length using letters, numbers, and special characters.

  65. Caesar Cipher Encryption: Program to encrypt a message using Caesar cipher.

  66. Caesar Cipher Decryption: Program to decrypt a message encoded with Caesar cipher.

  67. Check for Pangram: Program to check if a string contains all letters of the alphabet.

  68. Count the Number of Words in a String: Program to count the number of words in a given string.

  69. Find the Longest Word in a String: Program to find the longest word in a given string.

  70. Find the Shortest Word in a String: Program to find the shortest word in a given string.

  71. Count the Number of Sentences in a String: Program to count the number of sentences in a paragraph.

  72. Find the Mode of a List: Program to find the mode (most frequent value) in a list.

  73. Check if a Number is a Perfect Square: Program to determine if a number is a perfect square.

  74. Solve Quadratic Equation: Program to solve a quadratic equation given its coefficients.

  75. Check if a Number is a Strong Number: Program to check if a number is a "strong" number (sum of factorials of digits equals the original number).

[75 - 100 ] problems focusing on Object-Oriented Programming (OOP) concepts:

  1. Create a Class for a Circle: Define a class Circle with attributes for radius and methods to calculate area and circumference.
  2. Create a Class for a Rectangle: Define a class Rectangle with attributes for length and width, and methods to calculate area and perimeter.
  3. Bank Account Class: Define a class BankAccount with methods for deposit, withdrawal, and balance inquiry.
  4. Class Inheritance Example: Create a base class Person and a derived class Employee with additional attributes for job title and salary.
  5. Car Class with Encapsulation: Implement a Car class with private attributes for make, model, and year. Provide methods to access and modify these attributes.
  6. Class for Managing Student Grades: Define a class Student with attributes for name and grades, and methods to calculate the average grade and determine pass/fail status.
  7. Polymorphism Example: Create a class Shape with a method area(), and derived classes Square and Circle that override this method to calculate the area based on their properties.
  8. Overloading Operators in a Fraction Class: Create a class Fraction and overload the addition, subtraction, multiplication, and division operators for fraction objects.
  9. Implement a Stack Using a Class: Define a class Stack with methods to push, pop, and display elements in a stack.
  10. Class for Book Management: Create a Book class with attributes for title, author, and genre, and methods for lending and returning books.
  11. Class for Complex Numbers: Define a class ComplexNumber with methods to add, subtract, and multiply complex numbers.
  12. Abstract Class Example: Create an abstract class Animal with an abstract method sound(), and derived classes Dog and Cat implementing the method.
  13. Class for Managing Library Inventory: Create a Library class with methods to add, remove, and display books in a collection.
  14. Multilevel Inheritance Example: Implement classes Vehicle, Car, and ElectricCar to demonstrate multilevel inheritance.
  15. Multiple Inheritance Example: Create two classes Teacher and Author, and a third class Person that inherits from both, with a method to show combined information.
  16. Create a Class for a Queue: Define a class Queue with methods to enqueue, dequeue, and display elements in a queue.
  17. Singleton Pattern Example: Implement a singleton pattern for a class DatabaseConnection to ensure only one instance is created.
  18. Class for Handling Employee Data: Create an Employee class with methods to calculate salary, tax, and bonuses based on job role and experience.
  19. File Management Using a Class: Create a class FileManager to handle file operations like reading, writing, and appending to files.
  20. Method Overriding Example: Create a base class Appliance with a method start(), and override this method in the derived classes WashingMachine and Refrigerator.
  21. Class for Managing a To-Do List: Implement a ToDoList class with methods to add, remove, and display tasks.
  22. Create a Class for a Shopping Cart: Define a class ShoppingCart with methods to add items, remove items, and calculate the total price.
  23. Class for Handling Date and Time: Implement a class DateTimeManager with methods to display current date/time, calculate time difference, and format date.
  24. Create a Class for a Game Character: Define a class GameCharacter with attributes like health, attack power, and defense, and methods for attacking and defending.
  25. Class for a Calculator: Create a Calculator class with methods for basic arithmetic operations (addition, subtraction, multiplication, and division).