r/learnpython • • Apr 10 '19

My recent interview experience on Python.

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.

412 Upvotes

83 comments sorted by

View all comments

9

u/[deleted] Apr 10 '19

Reverse a sentence without using slicing.

This is a dumb question, in practice just use the best solution there is.

1

u/Dexteroid Apr 10 '19

There are no dumb questions. in Python we use so many things which are python oriented and don't exist in other languages, some times the interviewers are looking for an agnostic solution which is more generic. All the people who are using .reversed(), .sorted() might not actually be able to implement a reverse function or sorted. The idea is not to write a reverse function, the idea is whether you understand what goes on behind it.

2

u/[deleted] Apr 10 '19

I guess, but if the code works and is efficient then it's okay. And you can look up reversed() in 30 seconds.

I wrote our interview process, we have a Docker image with some questions (mostly focussing on SQL).

For Python we focus more on testing, linting, using type hints, etc. for good deployment practices, as those are the things that really can trip us up.