Published in


Python interview questions — beginner’s guide

A quick guide for interview preparation for a Python and Django profile opportunity for beginners

The general expectation from this story would also include the answers for the interview questions also but I, however, believe it would be much beneficial the other way. If you feel like you do not know the answer then you will learn more than just the answer to the question on exploration. It’s also naive to assume the answer to be bound in a few sentences based on one person’s (mine) experience. It’s always to best understand the concept around the answer and explain in own terms rather than reusing terms (except for technical terms).



  • What are the different data types in Python?
  • What are the different mutable and immutable data types in Python?
  • What’s the difference between a tuple and a list?
  • Write a program to merge two lists in one line.
  • Create a list of even numbers in single line code.
  • How to get input from a user in Python.
  • What are the different scopes in Python? Explain with an example.
  • Is Python a general-purpose programming language?
  • What is the easiest way to remove duplicates in Python?
  • Write a program to loop through a dict.
  • What are different ways of initializing 1. dict, 2. list, 3. tuple.
  • Write a program with a class with public, private and protected methods.
  • How are arguments passed in Python (by value or by reference)?
  • What is dict and list comprehension. Explain with an example.
  • How to handle exceptions in Python. Explain with an example.
  • Reverse a list in Python in one line.
  • Write a program to print a string in reverse order.
  • Write a program to get a full name and assign first and last name into separate variables.
  • Swap two variables in one line.
  • How to replace the word “Cracking” in the string “Cracking the interview” with “Acing”.
  • Write a program to read a CSV file and print the content in a tabluar format.
  • What are pickling and unpickling in Python?
  • Write a program to get the least common multiple (LCM) and Greatest common divisor (GCD) in Python.
  • Write a Python program to convert seconds to days, hour, minutes, and seconds.
  • What are decorators in Python? Explain with an example.
  • What are Lamda functions in Python? Write a Python program to cube every number in a given list of integers using Lambda.
  • Find the sum of numbers in a list using reduce function.
  • Write a code to create a list with even numbers from an existing list using the filter function.
  • Write a code that accepts a list of numbers and checks if the number is prime using lambda and map function.
  • Write a function to sort numbers in a list.
  • Output of

if “false”: print(10)

  • What are the different data types that dict keys support?
  • What is PYTHON PATH variable?
  • List down some commonly used modules in Python (or used by you).
  • What are magic methods in Python? Or Give some examples of Magic methods in Python?
  • How to perform debugging in Python(tool or methods used)?
  • What is PEP8? State some guidelines mentioned in PEP8.
  • Explain namespaces in Python.
  • What are iterators and generators? Explain with an example.
  • How are iterators different from generators? Is Iterator a generator or vice versa true?
  • How to perform a deepcopy in Python?
  • What is a docstring in Python? How is it useful?
  • Write a program to print two sentences with a delay of 2 seconds between them
  • What are class decorators and function decorators? Write a sample decorator for each type.
  • Explain inheritance in Python with an example.

I would cover the Python interview questions for intermediate and expert level in another story to avoid this story getting any longer, one of the reasons for which I wanted to avoid adding the answers too.

Hope this was helpful, please let me know in your comments what other questions could be added as part of this.




A space to share technology & programming blogs.

Recommended from Medium

Reactive Software Development

Staking Pool Migration Guide

SKB — Scala Curry

What is a web application and how does it work

PIR Motion Sensor

#DeFi #InsureDAO

SKB — Scala foldLeft

Solidity function types

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manu mathew

Manu mathew

Software engineer in Silicon valley of India - Bangalore/Bengaluru

More from Medium

10 FAQ : Python Interview

Python Keywords & Identifiers

Magic Methods In Python

Robot Framework in Python