Saturday, 2 September 2023

Important Python Lead Developer Interview Questions and Answers - Part 2

 Q: Write a Python program to elaborate Decorator


Ans: There is no better example than this


Q: Write a python code to get the middle node of a Linked List

Ans:



Q: Write a Python code to flatten the nested list

Ans: We use the recursion concept to solve this problem


Q: You are given some information about  people. Each person has a first name, last name, age and sex. Print their names in a specific format sorted by their age in ascending order i.e. the youngest person's name should be printed first. For two people of the same age, print them in the order of their input.

For Henry Davids, the output should be:

Mr. Henry Davids

For Mary George, the output should be:

Ms. Mary George

Sample Input

3

More  Thomberg  20  M

Roger bean  32  M

Andrue  Banjar 30  F


Sample Output

Mr. More  Thomberg 

Ms. Andrue  Banjar

Mr. Roger bean


Ans:





No comments:

Post a Comment