They had me build an sms scheduler to integrate with Twilio using AWS services to handle scheduling. Yeah, this accurately portrayed the skills needed to do my job; it was also a paid interview, so they paid me for the time that it took to do which was pretty sweet. Edit: Trello -> Twilio b/c I can't think Answer from xrendan on reddit.com
🌐
Reddit
reddit.com › r/learnprogramming › should i choose to code in technical interviews with python or c++?
r/learnprogramming on Reddit: Should I choose to code in technical interviews with Python or C++?
August 4, 2023 -

I’m sorry if this is a repeated question but I’m really anxious. I’m a rising senior with interviews this semester.

Here’s the situation: I need to focus on a language to ace the technical interviews. I have learnt all the data structures (tree, hash maps,heap,etc) on C, but from the past year I have been using python really heavily and I’m super familiar with it.

However, no way I’m using C in interviews. My friends are learning C++ because they believe that it gives an advantage over python. So my question is if that’s true for DSA and algorithms?

I feel that I should stick to python and learn the dsa and algorithms there. There shouldn’t be a major difference in the approach to solving the problem right? Only the syntax will differ.

Is it worth learning C++ because it’s almost like C or stick to python and learn it’s syntax?

Also is there any material that has every dsa and algorithm? And for interview syllabus like computer network, operating systems, etc?

Edit: Thank you everyone for your replies. Looks like I will stick with python for the interviews for now. But I will definitely learn C++ in the future. Also thank you for letting me know that the algorithms text book is more than enough.

🌐
Reddit
reddit.com › r/learnpython › i'm a beginner in python and have a coding interview tomorrow. how cooked am i? how can i save myself from 1 hour of embarrassment?
r/learnpython on Reddit: I'm a beginner in python and have a coding interview tomorrow. How cooked am I? How can I save myself from 1 hour of embarrassment?
October 14, 2024 -

I'm a data analyst with a fair understanding of Python. I was interviewed for a Data QA Engineer position, and the coding round is tomorrow. I'm getting extremely anxious about making a fool out of myself tomorrow and need any last-minute tips and tricks to help myself even a little bit.

UPDATE: There was no live coding or any coding at all. It's weird because the email said there would be live coding in Python, but instead, they asked me probability and logical reasoning questions. IMO, that is a better assessment of my intellectual ability, so I'm happy! Thank you for your kind words and encouragement; they helped me immensely. I will post another update if I receive an offer or not.

🌐
Reddit
reddit.com › r/python › python interview questions
r/Python on Reddit: Python interview questions
August 19, 2013 -

I'm about to go to my first Python interview and I'm compiling a list of all possible interview questions. Based on resources that I've found here, here and here I noted down the following common questions, what else should I add?

easy/intermediate

  • What are Python decorators and how would you use them?

  • How would you setup many projects where each one uses different versions of Python and third party libraries?

  • What is PEP8 and do you follow its guidelines when you're coding?

  • How are arguments passed – by reference of by value? (easy, but not that easy, I'm not sure if I can answer this clearly)

  • Do you know what list and dict comprehensions are? Can you give an example?

  • Show me three different ways of fetching every third item in the list

  • Do you know what is the difference between lists and tuples? Can you give me an example for their usage?

  • Do you know the difference between range and xrange?

  • Tell me a few differences between Python 2.x and 3.x?

  • The with statement and its usage.

  • How to avoid cyclical imports without having to resort to imports in functions?

  • what's wrong with import all?

  • Why is the GIL important? (This actually puzzles me, don't know the answer)

  • What are "special" methods (<foo>), how they work, etc

  • can you manipulate functions as first-class objects?

  • the difference between "class Foo" and "class Foo(object)"

tricky, smart ones

  • how to read a 8GB file in python?

  • what don't you like about Python?

  • can you convert ascii characters to an integer without using built in methods like string.atoi or int()? curious one

subjective ones

  • do you use tabs or spaces, which ones are better?

Ok, so should I add something else or is the list comprehensive?

Top answer
1 of 5
52

I'll try my hand at a few:

What are Python decorators and how would you use them?

They extend past python, and are functions that take a function as an argument and return functions. A simple example might be a decorator that takes a function, prints its args to stdout, prints the return value to stdout, then returns that return value. The syntax in Python is usually done with the @decorator_name above a function definition.

How would you setup many projects where each one uses different versions of Python and third party libraries?

virtualenv

What is PEP8 and do you follow its guidelines when you're coding?

A coding standard, and I try to. pylint is a great help.

How are arguments passed – by reference of by value?

Probably all through reference, but I'm not sure about primitives under the hood. Anyone know this? If you pass f(12, 81), are those by value?

Do you know what list and dict comprehensions are? Can you give an example?

ways to construct a list or dict through an expression and an iterable.

>>> x = [(a, a+1) for a in range(5)]
>>> y = dict((a,b) for a,b in x)
>>> x
[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)]
>>> y
{0: 1, 1: 2, 2: 3, 3: 4, 4: 5}

Show me three different ways of fetching every third item in the list

[x for i, x in enumerate(thelist) if i%3 == 0]

for i, x in enumerate(thelist):
    if i % 3: continue
    yield x

a = 0
for x in thelist:
    if a%3: continue
    yield x
    a += 1

Do you know what is the difference between lists and tuples? Can you give me an example for their usage?

Tuples are immutable. A tuple might be a good type for a coordinate inst var in some class. Lists are ordered collections, but with a tuple, each index generally has a certain meaning, so coord[0] is the x coordinate and coord[1] is y.

Do you know the difference between range and xrange?

Range returns a list of the full sequence while xrange generates each element iteratively like you would with the "yield" keyword. This changes in python3, and the default behavior is to yield like xrange. I think xrange is out.

Tell me a few differences between Python 2.x and 3.x?

The previous answer. print is no longer a statement and is just a function ("print 5" won't work anymore and you need parens), they added the Ellipse object (...). That's all I know off hand.

The with statement and its usage.

It's for context management, and you can define your own that implement enter init and exit if it might help. This is very useful for opening and closing files automatically (with open(foo) as bar:)

How to avoid cyclical imports without having to resort to imports in functions?

Refactoring your code? Not sure. When I've ran into this I generally have restructured functions into different modules which ended up cleaning everything anyway.

what's wrong with import all?

You can overwrite functions and this can be dangerous especially if you don't maintain that module.

  • rewrite.py def open(foo): print('aint happening!')

  • test.py from rewrite import * z = open('test.txt')

    prints aint happening!

Why is the GIL important?

It has to do with preventing true multithreaded bytecode, and has been an issue forever. I think python bytecode execution is protected with the Global Interpreter Lock so every bc execution is atomic. Explained best here: http://wiki.python.org/moin/GlobalInterpreterLock

You might want to consider writing a multithreaded module or program in C and wrapping it with Python if this is an issue for you.

What are "special" methods (<foo>), how they work, etc

These are methods like str and gt, which override behavior of other global functions like str() and operators like >. enter and exit will be used with the with keyword, and there are many more like getattr. Overriding getattr can result in some very unpredictable behavior with a dynamic language like Python, and you should be very careful when you use magic like that.

can you manipulate functions as first-class objects?

Yes. eg. they can be passed as args to functions.

the difference between "class Foo" and "class Foo(object)"

class Foo(object) inherits from the new-style object. I don't know the specifics, but here's stack overflow: http://stackoverflow.com/questions/4015417/python-class-inherits-object

how to read a 8GB file in python?

Operate on chunks, and not one byte at a time. Be wary about the RAM of the host machine. What is the nature of the data such that it is so large? How are you operating on it? What are you returning? Are you accessing it sequentially or randomly? There's a lot more to ask than to answer here.

what don't you like about Python?

It's slow, and it can be too dynamic for certain tasks in my opinion. It is not compiled. It can be very unpredictable. People abuse the flexibility of it sometimes.

can you convert ascii characters to an integer without using built in methods like string.atoi or int()? curious one

struct.unpack("<I", foo)[0]

ord, chr

do you use tabs or spaces, which ones are better?

Spaces. Stick to PEP8 when possible.

Ok, so should I add something else or is the list comprehensive?

  • generators/yield keyword

  • what is multiple inheritance / does python have multiple inheritance

  • is Python compiled, interpreted and/or emulated

  • What differentiates Python from Ruby

  • How do you debug your Python? What's pdb and how do you use it?

  • How do you modify global variables in a function? Why should you avoid this?

  • Use of the re module... what is it, give an example, etc.

2 of 5
14

Would be very good if you added the brief answers for the questions above :)

🌐
Reddit
reddit.com › r/learnpython › where to practice for python interview ?
r/learnpython on Reddit: Where to practice for python interview ?
May 8, 2024 -

I’m beginner to intermediate in python. I work in quality assurance and have an interview coming up for python with robot framework job. I know robot framework well but not confident enough in python. I’m 100% sure they’ll ask me to code so please help me on where can I practice ? Thank you in advance.

🌐
Reddit
reddit.com › r/learnpython › python interview questions i can use in interviews
r/learnpython on Reddit: Python interview questions I can use in interviews
September 19, 2024 -

Recently my workplace has started hiring python developers and since I'm one of the python guy I am asked to take python interviews starting today.

Now in my 4-5 years of learning and working with python I have accumulated a lot python challenges in my head as I'd constantly trying to come up questions that an interviewer might ask me.

Yesterday I made some samples questions and share with my senior who found the questions little too deep for a 3 YOE Python full stack developer role.

Please give me few questions to get some idea that I can use or be inspired from to make new set of questions.

Also is this question really too much for such interview: Given a file containing very large string (around a gb), devise an optimal solution to get the first non repeating Character.

🌐
Reddit
reddit.com › r/cscareerquestions › python in coding interviews
r/cscareerquestions on Reddit: Python in Coding Interviews
April 14, 2017 -

I was just wondering how often Python is acceptable for coding interviews in general. At my last internship interview the interviewer asked me what I was comfortable in, and I said "Python and C++", and tested my knowledge in both.

However, I feel much much more confident in Python overall. To the point where when I practice Leetcode, I almost always choose to do the questions in Python. When it comes time to begin the search for actual FT positions, how often would I be able to use Python for the interview?

🌐
Reddit
reddit.com › r/dataengineering › what are some common python questions you’ve been asked a lot in live coding interviews?
r/dataengineering on Reddit: What are some common Python questions you’ve been asked a lot in live coding interviews?
May 18, 2025 -

Title.

I've never been though it before and don't know what to expect.

What is it usually about? OOP? Dicts, lists, loops, basic stuff? Algorithms?

If you have any leetcode question or if you remember some from your exeperience, please share!

Thanks

Find elsewhere
🌐
Reddit
reddit.com › r/leetcode › people who code in java/c#/js/etc but use python for coding interviews, how in-depth did you learn python?
r/leetcode on Reddit: People who code in Java/C#/JS/etc but use Python for coding interviews, how in-depth did you learn Python?
February 3, 2024 -

I'm a java guy but seems like Python is the way to go for coding interviews according to this sub as well as my friends.

Do you guys just use simple language constructs like for loops and methods, or do you also use the weird Python-exclusive list and dictionary comprehension in interviews and leetcode?

Is it feasible if I use python for coding interviews/leetcode but code in the same style I write my Java code? Or are list/dictionary comprehensions a necessary evil if I want to use Python?

Top answer
1 of 4
19
Just use Java, you have a massive advantage in hours on keyboard in the language if you ever get into an interview, and someone starts asking you questions about the language, or uses a non-standard question. Plus, Java is top 3 anyway for LC. The minimal amount of stuff to learn, if you want to go with Python or just learn python anyway, would be: all the idioms around loops, iteration, then the data structure api for lists, set, dict, and then how to implement a stack, queue, and possibly some more exotic stuff from https://docs.python.org/3/library/collections.html like deque, defaultdict, et cetera. All LC answers are basically the same programming style: basic OO for the organization of mutable state, and single threaded imperative code with mutable data structures for the implementation of the algorithm. If you look at the editorials, the answers in C++/Java/Python all take the same approach, IMO, with the notable exception that Python does make a few things easier with shorter declarations, and a few library functions (like bisect) that cut down on the characters needed per programming idiom. Still, learning LC is a lot of content. If you can, just use the language you already know so you can focus on what you don't.
2 of 4
3
There's a good video on Python for coding interviews by NeetCode I use some things like this: list[1:] but I tend to mess up indexing on that, so it's kind of risky There's stuff like collections.counter too, but I don't really use them
🌐
Reddit
reddit.com › r/learnpython › my recent interview experience on python.
r/learnpython on Reddit: My recent interview experience on Python.
April 10, 2019 -

Role: Automation Test Developer.

Questions asked:

1: Basics of Linux, few tricky commands, what are inodes, setting up networking etc etc.

2: Python:

Given a file, write a function which accepts a version 
number, date and returns pass or fail. 

 EDIT:
 the file structure is basically a test result log file which contains lines of information.
 Each line has a version and date, tests run and results. 
 I was supposed to return results which are pass fail based on the version number and date given.:)


Reverse a sentence without using slicing.

List comprehension basics. 

What I did right: I wrote enough code solving pythonic interview problems, and I was comfortable writing the code in the interview.

what I did wrong: Focused too much on interview type problems, like Coin change, linked list etc etc. Should have also focused on some real use cases of python. For example, how to test a code with different inputs, how to parse few lines from a file, how to schedule a cron job etc etc.

TLDR; Don't just bust your head trying to solve interview challenges from cracking the coding interview. Also learn to make some real world programs.

🌐
Reddit
reddit.com › r/python › how should i prepare for python interview?
r/Python on Reddit: How should I prepare for Python interview?
April 5, 2016 -

Hi,

I learned web application development by myself, two years ago. Since then, I worked on Django, Bootstrap, Python, Javascript. I have an interview lined for a Python Engineer role. Can somebody suggest me the questions can be asked from a two years experienced guy in Python. Thanks!

Top answer
1 of 5
6
For a 2 years experienced position, you should probably be familiar with the internals. I'd especially be interested in things like Iterator vs Iterable Mutable data-structures vs Immutable the internal implementation of python datastructs like list, dict, set. You'd be expected to use this so you should be familiar with how efficient are these w/ r/t to different things like search, insertion etc. whether you are aware of useful Python tools like generators, Context managers which improve the efficiency and readability whether you are thorough with aspects of testing (unittest, TDD, mocking etc). There's no good Python code without good tests. be prepared to whiteboard simple exercises. Start with the most straightforward implementation and feel free to use Pythonic idioms (like list comprehension) as you optimize the code. you'd be expected to know the tools Python provides and know how to use them.
2 of 5
3
In 9 years since college and a number of job moves, I've had zero "technical interviews". Your mileage on that might vary. Some managers like them. Generally I get questions along the lines of, "How would you go about solving a business need where Xyz happens?" I can then answer based upon knowing what solutions are generally appropriate. I could say, "Well, I think this would be most accessible as a mobile app, but since it only displays simple data, I would recommend a mobile friendly web page--perhaps with a Cordova wrapper--instead of spending the time on a native application." In short, be personable and friendly. People want to work with someone they can get along with. If you have enough technical talent to do the job, it will come out in conversation. If you have a technical interview, I'm guessing they will only look for general indication of competence because every developer will forget basic things when asked on the spot now and then. :)
🌐
Reddit
reddit.com › r/python › how to crack competitive programming interviews for python ?
r/Python on Reddit: How to crack competitive programming interviews for python ?
August 4, 2020 - This book is so OP in the current meta its basically scripting! It gives you answers to all the Python specific interview questions you might get asked and gives you tons and tons of tools that you can use to solve the interviews questions with less lines of code.
🌐
Reddit
reddit.com › r/leetcode › python tricks to use in your coding interview
r/leetcode on Reddit: Python Tricks to Use In Your Coding Interview
October 9, 2024 -

Folks choose to write in Python in interviews, even if it's not their primary language at work. The problem is they code in Python but think in other languages, failing to leverage the full potential of idiomatic Python.

I've gathered the top mistakes non-Pythonist candidates make when writing code during interviews, along with how to improve them:

____________________________________________

Before we dive into the list, let me introduce myself: My name is Nurbo and I'm an ex-FAANG Senior Software Engineer currently on sabbatical. I have a newsletter where I send tips like this every day straight to your inbox: blog.faangshui.com. Let's connect on Linkedin! Now let's get back to the list...

____________________________________________

1. Inefficient Looping Over Indices Instead of Elements

How People Write It:

nums = [1, 2, 3, 4, 5]
for i in range(len(nums)):
    print(nums[i])

How It Can Be Better Written:

nums = [1, 2, 3, 4, 5]
for num in nums:
    print(num)

Explanation:

  • Issue: Using range(len(nums)) to iterate over list indices is unnecessary and less readable.

  • Improvement: Directly iterate over the elements using for num in nums, which is more Pythonic and efficient.

2. Manually Managing Loop Indices When Enumerate Exists

How People Write It:

words = ["apple", "banana", "cherry"]
index = 0
for word in words:
    print(f"{index}: {word}")
    index += 1

How It Can Be Better Written:

words = ["apple", "banana", "cherry"]
for index, word in enumerate(words):
    print(f"{index}: {word}")

Explanation:

  • Issue: Manually incrementing an index variable is error-prone and verbose.

  • Improvement: Use enumerate() to get both the index and the element in each iteration.

3. Using Traditional Swapping Instead of Tuple Unpacking

How People Write It:

temp = a
a = b
b = temp

How It Can Be Better Written:

a, b = b, a

Explanation:

  • Issue: The traditional method requires an extra variable and more lines of code.

  • Improvement: Python's tuple unpacking allows swapping variables in a single, clear statement.

4. Not Utilizing defaultdict for Counting

How People Write It:

counts = {}
for item in items:
    if item in counts:
        counts[item] += 1
    else:
        counts[item] = 1

How It Can Be Better Written:

from collections import defaultdict
counts = defaultdict(int)
for item in items:
    counts[item] += 1

Explanation:

  • Issue: Manually checking for key existence leads to verbose code.

  • Improvement: Use defaultdict(int) to automatically initialize counts to zero.

5. Not Utilizing Counter from collections for Counting Elements

How People Write It:

def is_anagram(s, t):
    if len(s) != len(t):
        return False
    count_s = {}
    count_t = {}
    for c in s:
        count_s[c] = count_s.get(c, 0) + 1
    for c in t:
        count_t[c] = count_t.get(c, 0) + 1
    return count_s == count_t

How It Can Be Better Written:

from collections import Counter
def is_anagram(s, t):
    return Counter(s) == Counter(t)

Explanation:

  • Issue: Manually counting elements is verbose and error-prone.

  • Improvement: Use Counter to efficiently count elements and compare.

6. Not Using List Comprehensions for Simple Transformations

How People Write It:

squares = []
for num in nums:
    squares.append(num * num)

How It Can Be Better Written:

squares = [num * num for num in nums]

Explanation:

  • Issue: Using loops for simple list transformations is less concise.

  • Improvement: List comprehensions provide a readable and efficient way to create lists.

7. Not Using zip to Iterate Over Multiple Sequences

How People Write It:

for i in range(len(list1)):
    print(list1[i], list2[i])

How It Can Be Better Written:

for item1, item2 in zip(list1, list2):
    print(item1, item2)

Explanation:

  • Issue: Using indices to access elements from multiple lists is less readable.

  • Improvement: Use zip() to iterate over multiple sequences in parallel.

8. Not Using any() or all() for Checking Conditions

How People Write It:

def has_positive(nums):
    for num in nums:
        if num > 0:
            return True
    return False

How It Can Be Better Written:

def has_positive(nums):
    return any(num > 0 for num in nums)

Explanation:

  • Issue: Writing loops for simple condition checks adds unnecessary code.

  • Improvement: Use any() to check if any element meets a condition.

9. Re-Implementing sum(), max(), or min() Instead of Using Built-in Functions

How People Write It:

def find_sum(nums):
    total = 0
    for num in nums:
        total += num
    return total

How It Can Be Better Written:

def find_sum(nums):
    return sum(nums)

Explanation:

  • Issue: Manually calculating sums or finding maximum/minimum values is unnecessary.

  • Improvement: Use built-in functions like sum(), max(), and min() for clarity and efficiency.

10. Not Using set Operations for Common Set Logic (Intersection, Union, Difference)

How People Write It:

def common_elements(list1, list2):
    result = []
    for item in list1:
        if item in list2:
            result.append(item)
    return result

How It Can Be Better Written:

def common_elements(list1, list2):
    return list(set(list1) & set(list2))

Explanation:

  • Issue: Manually checking for common elements is less efficient.

  • Improvement: Use set operations like intersection (&), union (|), and difference (-) for cleaner and faster code.

11. Not Using Dictionary's get() Method with Default Values

__________________

Alright the list has gotten too long. You can find the rest in my blog: https://blog.faangshui.com/p/write-python-like-you-mean-it

🌐
Reddit
reddit.com › r/leetcode › is python the best language for interviews?
r/leetcode on Reddit: Is python the best language for interviews?
March 18, 2022 -

I code in java and my friend does too, however, he told me that python is way easier to code in. He told me that two sum can be done in half the lines of code that it would normally take you to do the same in java. Some people on YouTube have also mentioned this. I feel comfortable with java and despite everyone saying that python is easy because it reads like english, I despise that it does not have curly braces and the the indenting.

Is python really worth learning and does it actually make coding easier(friend says the libraries are more useful than java’s)?

🌐
Reddit
reddit.com › r/python › 150+ python interview questions and answers for freshers [latest]
r/Python on Reddit: 150+ Python Interview Questions and Answers for Freshers [Latest]
September 26, 2019 - Explanation of "With" is better explained by the Python Docs. the with statement allows the execution of initialization and finalization code around a block of code.