Blog Post

Below questions were asked in interviews of companies. A subsequent blog will give out about the solutions. 

Question 1

Given a list of numbers and a number find two numbers in the list that sums up to the number given? If no such combination exists output should be “None”. [Facebook]

 sample_list = [1, 2, 3, 4], 7 — (3, 4)

Question 2

 In a list where all numbers repeat thrice, there is one that only repeats twice. Find this number [Goldman Sachs]

 sample_list = [1, 2, 1,1, 2, 2, 3, 3] — 3

Question 3

 When should you use a List vs a Tuple?  [Saama Technologies]
 Give explanation

Question 4

 How is copy different from assignment operator(‘=’). What is the difference between shallow and deep copy? [Saama Technologies]

a = b # a = b.copy() # a = copy.deepcopy(b)

Question 5

What is the difference between iterators and generators? [Google]

Give Examples


The solutions will be provided in the next blog. 


Learn21 conducts an online Boot Camp for web development. If interested you can check the details here.