Translate

Thursday, 30 January 2020

How to Tackle a Python Interview

How to Tackle a Python Interview

Have you cleared the first round of calls with the HR? Are you going for a Python interview in person? If you’re wondering what Python-related questions may be asked, this guide should be of help.

In the first section, we’ll discuss a few questions about Python's philosophy — those that help you make decisions about the architecture of a project. In the next section, we cover questions related to the Pythonic way of programming — which may manifest in the form of review or finding the output of a code snippet.

A word of caution before we start. This guide talks primarily about Python's built-in capabilities. The aim of this guide is to help you get up to speed with the inherent Python functionalities that enable quick development. So we won't be able to cover every question you may face from the various types of companies out there.

Development in Python: Project Architecture

What is Python? Why should you use Python?

If you’re interviewing for a Python role, you should have a clear idea of what Python is and how it’s different from other programming languages. Here are a few key points regarding Python that you should be aware of.

First, you should not be wrong about the etymology. A large section of Python programmers wrongly think that Guido van Rossum named it after the snake! On the contrary, Python is named after British sketch comedy Monty Python's Flying Circus. The next time you see a Python book with a snake on the cover, you may perhaps wish to stay away from it.

Next, Python is a high level, object-oriented, interpreted programming language. This means that Python code is executed line by line. Python is also dynamically typed, as it doesn’t require you to specify the type of variables when declaring them.

Given Python's ease of use, it has found uses for common automation tasks. Python is often the go-to scripting choice for programmers who know multiple languages. With the increasing popularity of Python-based web frameworks like Django and Flask, Python's share of the pie has increased significantly in recent years.

Limitations of Python

While it’s good to know about the capabilities of a programming language, it's also good to be aware of its limitations to truly comprehend the situations you need to be wary of.

The first limitation of Python is execution speed. Though development in Python is quick, executing a similar block of Python code is often slower compared to compiled languages such as C++. For this reason, hackathons often give Python programs some extra time for execution. There are ways to circumvent this issue, though. For instance, you can integrate Python with a compiled language like C to perform the core processing through the other language.

In a world which is going mobile first, Python is not native to mobile development. You will rarely find mobile applications developed in Python. The two major mobile operating systems, Android and iOS, don’t support Python as an official programming language.

Package Determination: Django vs Flask

In addition to Python's capabilities and limitations, a category of questions that are popular in interviews focuses around choosing between packages based on your requirements. Let’s look at one approach that you may take when tackling such questions.

Let's say you’re given a choice between Django and Flask to start a web application. The answer to this question should lie within an amalgamation of the requirements of the project and the culture of the organization.

At the outset, you should know that with the use of plugins, there’s no right answer here: you can create the similar applications using either framework. However, there’s a stark difference between the design philosophies of each framework. Flask provides you the bare minimum features for you to create a web application like URL routing, templating, unit testing and a development server, thereby giving you a lot of freedom to design your application. On the other hand, Django provides you a large array of built in features from the beginning — database support, extensive admin functionality, and security features.

If you’re building an application that will use relational databases, with a lot of dynamic content, you should probably choose Django. However, if you’re looking for a lot of freedom in your project, you should opt for Flask.

The post How to Tackle a Python Interview appeared first on SitePoint.



No comments:

Post a Comment