This is a collection of basic coding problems.
Problems on Array
- Python program to find the sum of all elements of an array
- Python program to find a series in an array consisting of characters
- Python program to find the occurrence of a particular number in an array
- Python program to find the largest element in an array
- Python program for array rotation
- Python program to find remainder of array multiplication divided by divisor.
- Find the union and intersection of two arrays in Python.
- Python program to create and print a matrix.
- Python program to create matrix using numpy.
- Python program for matrix operations
- Python program to get matrix as input from user and print it.
- Python program to add two matrices and print the resulting matrix
- Program to filter matrix based on a condition
- Python program to illustrate the working of lambda functions on array
- Python program to apply lambda functions on array
- Python program to find the GCD of the array
- Python program to find the LCM of the array elements
- Write a python program to explain how filter(),map(),reduce() functions work.
Problems on Strings
- Python program to print a string, extract characters from the string
- Python program to print words with their length of a string.
- Python program to print EVEN length words.
- Count vowels in a string
- Python program to pass a string to the function.
- Python program to Create multiple copies of a string by using multiplication operator
- Python program to check if a substring presents in a string
- Program to find the maximum frequency character in the string
- Python code to count number of substrings of a string.
- Python program to reverse a string using stack.
- Python program to reverse a string using reversed() method.
- Python program to split string into array of characters using for loop.
- Python program for slicing a string.
- Python program to repeat M characters of a string N times.
- Python program to swap two numbers using third variable.
- Python program to swap two numbers without using third variable.
- Python program to swap characters of a given string.
- Python program to remove a character from a specified index in a string.
- Python program for adding given string with a fixed message.
- Python program to find all permutations of a given string.
- Write a function to find sum of two integral numbers in string format in python.
- Python program to check whether a string contains a number or not.
- Python program to find the matched characters in a given string.
- Python program to Find the frequency of each character in a string.
- Python program to Extract the mobile number from the given string.
- Replace a special string from a given paragraph with another string in Python.
- Python program to find the ASCII value of each character of the string.
- Python program to convert a String to camelCase.
- Capitalizes the first letter of each word in a string in Python.
- Python program to check if a string is palindrome or not.
- Python program to input a string and find total number uppercase and lowercase letters.
- Python program to input a string and find total number of letters and digits.
- Python program to convert a list of characters into a string.
- Python program to Check if a variable is present in a string or not.
- Python program to check whether a variable is a string or not.
- Python program to count occurrence of a word in the given text.
- 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.
- Program to remove i-th character from string using concatenation.
- Program to remove i-th character from string in python using replace function.
- Python program to accept the strings which contains all vowels.
- Program to find the least frequent character in the string.
- Program to split and join a string using Python.
- Python program to find words which are greater than given length k.
- Program to check if the string contains any special character.
- Python program to find the maximum frequency character in the string.
- Program to check whether a given string is binary or not
- 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.
- Python program to find uncommon words from two string.
- Python program to print URL from a string.
- 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
-
Python Program to Calculate Student's Grade(Using basic loops).
-
Python Program to Calculate Student's Grade(Using class and object).
-
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.
-
Write a python program to show how the abstruction works.
-
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.
-
Write a python program to explain del() keyword.
-
Write a python program to define private class and its working.
-
Write a python program to define how Inheritance works.
-
Write a python program to explain how multi-level inheritance works.
-
Write a python program to explain multiple inheritance works.
-
Python example to implement destructor and constructors using del() and init()
-
Python Example to implement Getters and Setters in a class
-
Python Example to implement abstruct class and methods.
-
Implement Abstraction using Abstract class
-
Python program to implement Interface using class
-
Write a python program and explain how super method works.
-
Write a python program to explain how class attributes can be changed.
-
Write a python program to explain how methods workes(instance method, class method and static method)
-
Explain the concept of innerclass and outer class with a suitable example(here we are taking a car example).
-
Python program to Create Employee Class and show details.
-
Write a python program to define polymorphism using DUCK TYPING.
-
Python program to explain polymorphism using operator overloading.
-
Python program to Create Employee Class with Constructor and Destructor.
-
Example of single inheritance in Python (using car example).
-
Example of single inheritance in Python (using Library Management system).
-
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.
-
Example of inheritance with two child (derived) classes in Python.
-
Example of multiple inheritance in Python.
-
Example of multilevel inheritance in Python. (Print Student details)
-
Example of Multilevel Inheritance in Python. (Average of marks)
-
Example of hierarchical inheritance in Python.(Employee, Doctor, Engineer)
-
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.
-
Python program to illustrate constructor inheritance.
-
Python program to check prime number using object oriented approach.
-
Python program to count number of objects created.
-
Python program to check Armstrong number using object oriented approach.
-
Python program to check Palindrome number using object oriented approach.
-
Student height record program for a school in Python using oops.
-
Building Restaurant Menu using Class in Python using oops.
-
Program for students marks list using class in Python
-
Program to manage a phone store (mobile shop) record using class in Python.
-
Program to build flashcard using class in Python.
-
Python program to add two distances.
-
Python program to find elder of two persons.
-
Python program to add accounts in a bank (Bank Management System).
-
Python program to get student details as input and print the result after updating the marks.
-
Arrays of Objects Example in Python.
-
Searching of objects from an array of objects using ID in Python.
-
Hierarchical Inheritance Example in Python.
-
Constructor Initialization Example in Python.
-
Parameterized Constructor and Destructor Example in Python.
-
Python program to add numbers using Objects.
-
Multiple Inheritance Example in Python.
-
Multilevel Inheritance Example in Python.
-
Python program to add objects '+' using operator.
-
Write a python program to perform method overloading.
-
Write a python program to perform Method Overriding.
-
Write a python program to explain how filter function works.
-
Given a list of strings, write a python program to filter out the strings that have more than 2 characters.
-
Given a list of strings, write a python to filter out the empty strings.
-
Python program to see the working of filter() method.
-
Python program to search student record using percentage.
-
Python program to illustrate Matrix Addition using Class.
-
Python program to compare two objects using operators.
-
Python program to illustrate the working of list of objects.
-
Python program to convert hours into days.
-
Python program to illustrate the working of abstract method.
-
Python program to illustrate the working of decorators.......
-
Python program to pass objects as arguments and return objects from function.
60