Skip to content

Phoenixcoder-6/Basic-Python-Problems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic-Python-Problems

This is a collection of basic coding problems.

Problems on Array

  1. Python program to find the sum of all elements of an array
  2. Python program to find a series in an array consisting of characters
  3. Python program to find the occurrence of a particular number in an array
  4. Python program to find the largest element in an array
  5. Python program for array rotation
  6. Python program to find remainder of array multiplication divided by divisor.
  7. Find the union and intersection of two arrays in Python.
  8. Python program to create and print a matrix.
  9. Python program to create matrix using numpy.
  10. Python program for matrix operations
  11. Python program to get matrix as input from user and print it.
  12. Python program to add two matrices and print the resulting matrix
  13. Program to filter matrix based on a condition
  14. Python program to illustrate the working of lambda functions on array
  15. Python program to apply lambda functions on array
  16. Python program to find the GCD of the array
  17. Python program to find the LCM of the array elements
  18. Write a python program to explain how filter(),map(),reduce() functions work.

Problems on Strings

  1. Python program to print a string, extract characters from the string
  2. Python program to print words with their length of a string.
  3. Python program to print EVEN length words.
  4. Count vowels in a string
  5. Python program to pass a string to the function.
  6. Python program to Create multiple copies of a string by using multiplication operator
  7. Python program to check if a substring presents in a string
  8. Program to find the maximum frequency character in the string
  9. Python code to count number of substrings of a string.
  10. Python program to reverse a string using stack.
  11. Python program to reverse a string using reversed() method.
  12. Python program to split string into array of characters using for loop.
  13. Python program for slicing a string.
  14. Python program to repeat M characters of a string N times.
  15. Python program to swap two numbers using third variable.
  16. Python program to swap two numbers without using third variable.
  17. Python program to swap characters of a given string.
  18. Python program to remove a character from a specified index in a string.
  19. Python program for adding given string with a fixed message.
  20. Python program to find all permutations of a given string.
  21. Write a function to find sum of two integral numbers in string format in python.
  22. Python program to check whether a string contains a number or not.
  23. Python program to find the matched characters in a given string.
  24. Python program to Find the frequency of each character in a string.
  25. Python program to Extract the mobile number from the given string.
  26. Replace a special string from a given paragraph with another string in Python.
  27. Python program to find the ASCII value of each character of the string.
  28. Python program to convert a String to camelCase.
  29. Capitalizes the first letter of each word in a string in Python.
  30. Python program to check if a string is palindrome or not.
  31. Python program to input a string and find total number uppercase and lowercase letters.
  32. Python program to input a string and find total number of letters and digits.
  33. Python program to convert a list of characters into a string.
  34. Python program to Check if a variable is present in a string or not.
  35. Python program to check whether a variable is a string or not.
  36. Python program to count occurrence of a word in the given text.
  37. Python program to check if a pattern is present in a string or not. And then print all strings consisting of patterns from the array of string.
  38. Program to remove i-th character from string using concatenation.
  39. Program to remove i-th character from string in python using replace function.
  40. Python program to accept the strings which contains all vowels.
  41. Program to find the least frequent character in the string.
  42. Program to split and join a string using Python.
  43. Python program to find words which are greater than given length k.
  44. Program to check if the string contains any special character.
  45. Python program to find the maximum frequency character in the string.
  46. Program to check whether a given string is binary or not
  47. Program to execute Python code from a string: a block of code stored in a string and we will write a python program to execute this string's code.
  48. Python program to find uncommon words from two string.
  49. Python program to print URL from a string.
  50. Write a Python program to get a string from a given string where all occurrences of its first char have been changed to '$', except the first char itself.

Programs on class and object

  1. Python Program to Calculate Student's Grade(Using basic loops).

  2. Python Program to Calculate Student's Grade(Using class and object).

  3. Write a python program to create student class that takes name and marks of 3 subjects as arguments in constructor, then create a method to print the average.

  4. Write a python program to show how the abstruction works.

  5. Write a python program to create an Account class that takes balance and account number. Now create methods for debit, credit and printing the balance.

  6. Write a python program to explain del() keyword.

  7. Write a python program to define private class and its working.

  8. Write a python program to define how Inheritance works.

  9. Write a python program to explain how multi-level inheritance works.

  10. Write a python program to explain multiple inheritance works.

  11. Python example to implement destructor and constructors using del() and init()

  12. Python Example to implement Getters and Setters in a class

  13. Python Example to implement abstruct class and methods.

  14. Implement Abstraction using Abstract class

  15. Python program to implement Interface using class

  16. Write a python program and explain how super method works.

  17. Write a python program to explain how class attributes can be changed.

  18. Write a python program to explain how methods workes(instance method, class method and static method)

  19. Explain the concept of innerclass and outer class with a suitable example(here we are taking a car example).

  20. Python program to Create Employee Class and show details.

  21. Write a python program to define polymorphism using DUCK TYPING.

  22. Python program to explain polymorphism using operator overloading.

  23. Python program to Create Employee Class with Constructor and Destructor.

  24. Example of single inheritance in Python (using car example).

  25. Example of single inheritance in Python (using Library Management system).

  26. Example of single inheritance in python with given class and class methods. Classes used in the program: Class : Employee Method : getEmployeeInfo() : Gets input of the employee information from the user. Method : printEmployeeInfo() : prints the information of the employee. Method : getSalary() : return the salary of the employee. Class Perks : Method: getPerks() : calculates all perks of the employee. Method : putPerks() : prints all perks and employee details of the employee.

  27. Example of inheritance with two child (derived) classes in Python.

  28. Example of multiple inheritance in Python.

  29. Example of multilevel inheritance in Python. (Print Student details)

  30. Example of Multilevel Inheritance in Python. (Average of marks)

  31. Example of hierarchical inheritance in Python.(Employee, Doctor, Engineer)

  32. Example of Hierarchical Inheritance in Python. Classes and members: Class - student Method - getStudentInfo() : Gets input from user for variables of the class. Method - putStudent() : prints student information. Variable - rollNo : stores student's roll number. Variable - name : stores student's name. Class - Bsc Method - getBsc() : Gets input from user for variables of the class. Method - putBsc() : prints Bsc information and calls putStudent. Variable - p : stores student's physics marks. Variable - c : stores student's chemistry marks. Variable - m : stores student's maths marks. Class Ba Method - getBa() : Gets input from user for variables of the class. Method - putBa() : prints Ba information and calls putStudent. Variable - h : stores student's history marks. Variable - g : stores student's geography marks. Variable - e : stores student's economics marks.

  33. Python program to illustrate constructor inheritance.

  34. Python program to check prime number using object oriented approach.

  35. Python program to count number of objects created.

  36. Python program to check Armstrong number using object oriented approach.

  37. Python program to check Palindrome number using object oriented approach.

  38. Student height record program for a school in Python using oops.

  39. Building Restaurant Menu using Class in Python using oops.

  40. Program for students marks list using class in Python

  41. Program to manage a phone store (mobile shop) record using class in Python.

  42. Program to build flashcard using class in Python.

  43. Python program to add two distances.

  44. Python program to find elder of two persons.

  45. Python program to add accounts in a bank (Bank Management System).

  46. Python program to get student details as input and print the result after updating the marks.

  47. Arrays of Objects Example in Python.

  48. Searching of objects from an array of objects using ID in Python.

  49. Hierarchical Inheritance Example in Python.

  50. Constructor Initialization Example in Python.

  51. Parameterized Constructor and Destructor Example in Python.

  52. Python program to add numbers using Objects.

  53. Multiple Inheritance Example in Python.

  54. Multilevel Inheritance Example in Python.

  55. Python program to add objects '+' using operator.

  56. Write a python program to perform method overloading.

  57. Write a python program to perform Method Overriding.

  58. Write a python program to explain how filter function works.

  59. Given a list of strings, write a python program to filter out the strings that have more than 2 characters.

  60. Given a list of strings, write a python to filter out the empty strings.

  61. Python program to see the working of filter() method.

  62. Python program to search student record using percentage.

  63. Python program to illustrate Matrix Addition using Class.

  64. Python program to compare two objects using operators.

  65. Python program to illustrate the working of list of objects.

  66. Python program to convert hours into days.

  67. Python program to illustrate the working of abstract method.

  68. Python program to illustrate the working of decorators.......

  69. Python program to pass objects as arguments and return objects from function.

60

About

This is the collection of basic coding problems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages