Python Coding Interviews: Tips & Best Practices

James Uejio
James Uejio 22 Lessons 2h 21m best-practices career

You’ve made it past the phone call with the recruiter, and now it’s time to show that you know how to solve problems with actual code. Whether it’s a HackerRank exercise, a take-home assignment, or an onsite whiteboard interview, this is your moment to prove your coding interview skills.

But interviews aren’t just about solving problems: they’re also about showing that you can write clean production code. This means that you have a deep knowledge of Python’s built-in functionality and libraries. This knowledge shows companies that you can move quickly and won’t duplicate functionality that comes with the language just because you don’t know it exists.

At Real Python, we’ve put our heads together and discussed what tools we’re always impressed to see in coding interviews. This course will walk you through the best of that functionality, starting with Python built-ins, then Python’s native support for data structures, and finally Python’s powerful (and often underappreciated) standard library.

In this course, you’ll learn how to:

  • Use enumerate() to iterate over both indices and values
  • Debug problematic code with breakpoint()
  • Format strings effectively with f-strings
  • Sort lists with custom arguments
  • Use generators instead of list comprehensions to conserve memory
  • Define default values when looking up dictionary keys
  • Count hashable objects with the collections.Counter class
  • Use the standard library to get lists of permutations and combinations

What’s Included:

Downloadable Resources:

Related Learning Paths:

About James Uejio

James is an avid Pythonista and creates video tutorials for Real Python. He is a web developer at Wish and also produces lo-fi hip hop and plays jazz guitar.

» More about James

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Avatar image for brunosilvaferreira

brunosilvaferreira on June 7, 2021

I did dozens of RP Courses but this one is for sure one of the best, thanks!

Avatar image for ajitsekhar

ajitsekhar on Sept. 5, 2020

Amazing tutorial. Very helpful.

Avatar image for Ricardo Joseh Lima

Ricardo Joseh Lima on May 16, 2020

Yes, I reached the end of the course and it was extremely valuable! Thanks a lot for your work.

Avatar image for Cristian Palau

Cristian Palau on May 4, 2020

Thanks for the useful tips!

Avatar image for Pygator

Pygator on April 30, 2020

Lots of nice features displayed, and a review of some basic to intermediate skills. Thanks; the problems were interesting.

Hey James, thanks for this outstanding series, it’s actually way more than a help for an interview - it’s an overview of a lot of cool tips and tricks.

However, in this example I think that running the doctest with these expected outputs doesn’t quite cut it, especially for add_person and bypass_queue. If I understand that correctly, the return string of those methods is only based on the input name, not on what happens to the list/deque. Maybe checking for the actual state of the deque could provide a better solution? But maybe I’m just a bit nitpicky here…

Whatever, the series is great, learned a lot of things I can expand on now.

Best, Max

Avatar image for Qasim Albaqali

Qasim Albaqali on April 22, 2020

This is such a good course! The content is superb, thank you :)

← Browse All Courses