Welcome to Pylenin Weekly #13, a newsletter dedicated to improving the lives of my fellow peers through knowledge sharing in the field of programming and Data.
Owing to my professional commitment to my employer, I had to travel to Chennai the past few weeks. That's why, I was unable to create and send out the Pylenin Weeklys!
But never mind, since I am back! I promise to be more sincere with Pylenin Weekly, so that all of you can actually benefit from my knowledge and we are able to share knowledge proactively to help with our careers.
I have turned Interviewer!
Recently, one of my friends from a startup, asked me to help him hire a Data Warehouse Engineer. I agreed instantly and helped him set up 3 rounds of tests, interviews and a walk-in session to hire the perfect candidate.
Good news! He was able to lock in 2 people through the process. We both are very happy with the choices we made.
Here is the best part! I am going to share with you the questions I had prepared to ask the candidates.
Let's make this interesting! How about I just give you the questions. You try to solve/answer them and if you think you are correct, tweet them to me! I would be happy to share your answer on my feed!
So here goes!
SQL Based Questions
- What is the difference between
- Write a window function to calculate the Month-to-date sum of a revenue column in SQL.
- What is the difference between
HAVING- Where would you use, what?
Python Based Questions
Explain Tuple Swap.
Without running the below code, explain, what error will it throw.
def hello(): ... print(hello())
Force the user for an argument in this code.
import argparse my_parser = argparse.ArgumentParser() my_parser.add_argument('-c', action='store', choices=['heads', 'tails']) args = my_parser.parse_args() print(vars(args))
What does the following code print?
list1 =  bool(list1)
Do share your answers, or any opinions on this question through twitter @pylenin. I would love to interact with you!
I recently wrote an article on Python Lambda functions. Lambda functions are super short and super helpful. Learning the concept properly, would be one hell of an accomplishment for any beginner in the field of Python.
Check out my article here!
About using generic exception!
What if we want some exception to happen or we may not want to handle a certain exception ! Like exiting the program by using keyboard exception!
That will also be handled by the program and the program wont exit."
My dear friend,
Thanks for the question.
First of all, here is some bad news!
Control-C will raise a
KeyboardInterrupt no matter how much you don't want it to.
Good news is, you can pretty easily handle the error, for example, if you wanted to require the user to hit control-c twice in order to quit while getting input you could do something like:
def my_input(prompt): try: return input(prompt) except KeyboardInterrupt: print("press control-c again to quit") return input(prompt) #let it raise if it happens again
Try the above code and let me know how it works for you!
I hope you have learnt something good out of today's newsletter. See you again next week with new blogs, new comments and something damn interesting!
FYI - You can support me continue this newsletter, by becoming a paid member of Pylenin. It doesn't cost much and has a lot of benefits!