Write and Test a Python Function: Interview Practice (Overview)
Whether you’re looking to ace your coding interview or simply to level up your development skills, solving coding challenges can help you grow as a programmer. In this Real Python Code Conversation, Philipp challenges Martin to write a function that doubles each character in a string. Through their conversation, you’ll learn how to tackle a coding challenge and stand out from the pack in your job search.
In this video course, you’ll learn how to:
- Use functions to write reusable, maintainable code
- Communicate your thoughts in a coding interview
- Use
if __name__ == "__main__"
to build multipurpose code - Write tests and use test-driven development
At the end of the course, you’ll get to hear how Martin did with the coding challenge, and you’ll leave with resources for further exploration.
00:01 Welcome to Real Python Code Conversations. I’m Philipp, and today I will challenge my teammate Martin with a coding challenge.
00:09
I want him to create a function that accepts a string, and the function should return a string with each character in the original string doubled. So if the function takes the word Martin
, I want the function to return MMaarrttiinn
.
00:28
While Martin tries to solve this coding challenge, you will learn a few things along the way. You’ll learn how to tackle a coding challenge, why functions are a good idea, how to communicate your thoughts in a coding interview, what happens when you import a module, and when you should use if __name__ == "__main__"
.
00:49 In addition to solving the coding challenge, Martin will even go a few steps further and create some tests. He will also show which conventions about tests exist and what test-driven development is.
01:04 Real Python Code Conversations is an unfiltered video course format. Martin and I will have a conversation about the code he writes. The session was recorded in one go, but I will jump in now and then to explain some things. All right, let’s get started.
Become a Member to join the conversation.