flat a nested list in python | flat implementation in python
Some time we have a nested list which we want to make in one dimensional array or you can say we want to flat it. def flat(arr): #base condition if…
Some time we have a nested list which we want to make in one dimensional array or you can say we want to flat it. def flat(arr): #base condition if…
Celebrity is the person to whom everyone know but he do not know any person. This problem one of the programing problem that asked in companies Problem Statement: You are…
We can generated all possible combination of alphabets or number using python with only few lines of code. We can use these combination to give unique identity to any one.…
The ternary operator is very useful for a single condition. But support ternary operator different way, not like other programming languages (?:). Syntax: A if C else B This first…
Problem statement: You have an array of number like [1,3,4,6,8] we need to find that these numbers are permutation of number or not, considering all numbers in an array. example:…
String formatting or Interpolation is an essential part of any programming language. In python string formatting can be done in different ways. It helps a programmer to create dynamic strings…
Here are my python interview/job preparation questions and answers. Which can help to to clear the interview or also help to take interview of any candidates. What is list ?…
Stack implementation: class Stack: def pop(self): return self.items.pop() def __init__(self): self.items = [] def push(self, item): return self.items.append(item) def size(self): return len(self.items) def peek(self): return self.items[len(self.items)-1] def isEmpty(self): return len(self.items)…