Python interview question 1

Python interview questions [Closed]

I will be doing an interview for an internship on Python programming within two weeks.

Can someone suggest what possible areas to polish? I'm looking for frequently asked questions in interviews for Python openings. Aside from the fact that I've mastered the language for over a year, I don't understand what you can ask me.

As with a C or C ++ interview, there are many questions, from reversing strings to creating linked lists. However, in a Python interview, I'm at a loss.

Personal experiences and / or suggestions are welcome.


Here are some simple ones:

  1. What are Python Decorators and How Would You Use Them?
  2. How do you debug your python code?
  3. How would you set up many projects where both were using different versions of Python and third party libraries?
  4. Do you follow PEP8 when writing your code?

How about something with Python list comprehension? For me, this was one of the big selling points for C ++ after reading about it in Dive into Python.

Msgstr "Write a list comprehension that makes a list of even numbers from 1 to 10, inclusive".
If the answer is something like this (note that the Distance values avoid a fence post mistake):

If you understand all of the concepts listed in Dive into Python, this should cover most of the important functions.

If Python is to be passed by reference or by value, this is also a very good question.

Questions I have been asked:

  • Describing two methods of metaprogramming in Python.
  • What is the GIL?
  • Why is the GIL important?
  • Why is there an alternate implementation of Python called Unladen Swallow?
  • Django, pylons or zope? Defend your position.

I don't have any such experience, but here are some guesses:

  1. (Immutability
  2. First class functions / classes
  3. Closures

Python programmers should know this, otherwise you can also hire C programmers for the position.

I would go through the list in this answer. Using this list, try to update what you know as much as possible. Don't worry if you can't make it to the end.

What's your point, are you going to try to test if you know Python, if you can do things in Python, or if you can program (in Python)?

They are very different things.

If they want you to show that you know Python, they can force you to do things like create a generator, and then do so without using. Explain how the class works. Explain the order of resolution of the C3 method. And so on.

If you want to show that you can work in Python, you need to understand the basic data structures and have a list of libraries that you will need for various tasks. So you need to be familiar with dictionaries, sets, and arrays. Likewise, you need to know about things like parsing HTML, be able to talk about a framework that can be used for web development, etc. You don't necessarily need to know how to use these things well, but you should know where to find out how to find out more and actually use it when the interviewer gave you things that are documented.

If you want to show that you can program (in Python) you need to know the basic data structures and your algorithms. This is much closer to the C / C ++ questions you are asked, except that you need to use native data structures that make your life easier.

To be sure, you should prepare for all three to some extent. For example, read and take notes. Hopefully you already know how to program. Then try some random tasks and force yourself to use libraries that you may have missed. For example, read a CSV file, programmatically extract information from a webpage, build a small website with a framework, etc.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.