Preparing for a Python Interview: 10 Things You Should Know

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

They missed the most important thing... How to get an interview in the first place.

👍︎︎ 8 👤︎︎ u/Allevil669 📅︎︎ Oct 12 2015 🗫︎ replies

What I don't like about the whole premise here is that you make it about preparing for the interview which I kind of disagree with. Sure you should prepare for the interview but most of the things you talk about should be a preparation for the job!

And keep in mind that failing an interview isn't necessarily a bad thing. In most cases it just means that you're either not ready for this job yet or it just doesn't match your skill set. Also, soft skills and social fit is a big deal in many companies.

Finally, one of the biggest things that are missing on your list is that you should have the right mindset. Be eager to learn, know how to help yourself, know when and where to get help, always ask for best practices, develop what I'd call a developer's sixth sense.

PS: Not knowing about list comprehensions might just as well be a plus because they're usually harder to read than just a normal iteration.

👍︎︎ 6 👤︎︎ u/dAnjou 📅︎︎ Oct 12 2015 🗫︎ replies

People still do $LANGUAGE interviews? Not "knowing CS fundamentals", not "knowing software engineering", but Python interviews, Java interviews and PHP interviews?

👍︎︎ 4 👤︎︎ u/Igggg 📅︎︎ Oct 12 2015 🗫︎ replies
Captions
hey everybody how's it going in this video we're going to learn how to prepare for a Python interview and ten things that you should know before going into this interview so I'm going to go over some different advice and we'll also look at some code examples to get you ready so one thing before I get started is that a lot of what I'm going to say here applies to entry-level Python positions so if you're applying for a senior level position then likely that's going to require you to know all of the items in this list but then you'll also need to know some more advanced topics as well so with that said let's go ahead and get started so the first thing is that you should know how to write code on a whiteboard area or a piece of paper now this isn't just specific to Python this goes for any programming language that you're going to have an interview with because a lot of companies won't have a computer setup for your interview so you're likely going to be in a room with either a notebook or a whiteboard and live coding might not even come up in your interview but if it does then you need to be ready to do that without a computer so if you've never done this before then you'd actually be surprised at how hard it is to not use a computer so you might want to go ahead and start doing all of your practice problems that you're preparing for your interview do them all on a whiteboard or on a piece of paper and then go back and check all of those answers on a computer to make sure that you got all the syntax correct and everything like that okay so moving on to number two know the basic control flow within Python so my control flow I mean know how to use for loops while loops if and else statements and things like that so I have a code example here that we can take a look at so I know a lot of this looks extremely basic but like I said before you're not going to have a computer so you want to know how to write these things out without thinking about it you're not going to have any auto-completion or anything like that so know how to write down a for loop and loop through a certain amount of numbers so if I run this code here it just loops these numbers you want to know how to use while loops because those could come up in an interview as well and then you also want to know how to use your if and else statements and also your L if statements here now I know these three things you know for loops while loops and these if statements I know it seems completely basic but you'd be surprised at how many people freeze up on these very basic questions whenever they are new to the interview process so just be sure that you can write them down all by hand and that you know I'm inside it out and exactly how the program is going to flow through all of these conditionals okay so number three be able to discuss how you've used Python in the past so your interviewer is likely going to ask you about past projects and you just don't want to draw a blank so if you've never used Python professionally and you're applying for an entry-level position then be sure to write a basic project before the interview so that you can have some example of something that you've written in your free time and also whatever you choose to write try to make it something that's interesting and that will be interesting to your interviewer you know just don't tell them how you've solved a bunch of sample interview problems like fizzbuzz and Fibonacci sequences and things like that so for example if you need a couple of ideas for some cool programs that you could write maybe you want to play around with web scraping and make a script that pulls weather information each day you can use the beautifulsoup module for that or you could write a program that performs system tasks so you could write a program that cleans up folders on your computer or move files around displays CPU and memory or something along those lines so for example I've written a really small program here that just goes uses the OS module and the glob module goes into this directory here if I run this code it just goes into my demo directory here and prints out all of the JPEG images so you know something like this just learn how to write a file like this and then whenever your interviewer ask you the question you know you can say something interesting like whoa once I did write a program that looked through my file system and found all these images and move them to a specific location or something like that so those are just a couple of examples and ideas to get you started but I'm sure that you can think of some really cool ideas on your own after thinking about it for a few minutes okay so number four know how to solve common interview problems and questions so a little bit ago I mentioned fizzbuzz and Fibonacci sequences and things like that those are some common questions that interviewers like to ask now there's been a lot of debate around that type of interview process on online forums a lot of people say that those type of problems aren't a good indicator of programming skill and that interviewer should should ask better problems that more reflect real-world situations but even though there's a lot of debate whether interviewers should ask those questions a lot of interviewers do ask those questions so so whether or not you think they should or shouldn't is a totally different discussion but but you should be prepared to at least answer those questions and really it doesn't take a long time to learn how to solve a lot of these common problems so like for example if you don't know what fizzbuzz is basically it is your interviewer will ask you to loop through a range of numbers and if the number is divisible by three then print out fizz if it's divisible by five print out buzz if it's divisible by both then print out fizzbuzz and this is a solution to the problem here if I print this out you can see that it loops through and every one that's divisible by three it prints out fizz and buzz and if it's divisible by both and it prints out fizzbuzz so usually these kind of questions are meant to weed out people who don't understand the basic concepts of a computer language so for example here you have to know how to use for loops and enter eight over a range of numbers you know them you have to know that modulo operator and some things like that and it's the same thing with the Nachi sequence that's another question that a lot of interviewers like to ask so the fibonacci sequence if you don't know what that is basically you print out a number and each each number that you print out is the previous two numbers added together so here let me just print out this example it'll be easier to show so you can see I printed out these numbers here so 0 and 1 if you add those together it equals 1 if you add 1 and 1 it equals 2 if you add 1 and 2 it equals 3 and it keeps going and keeps going so you can do this and let's see this is four lines of Python code here so like I said a lot of people don't like these questions because they're not the best indicator of programming ability but they do like to ask these questions and they're so short that it really wouldn't hurt you to learn how to solve these problems and not only should you learn how to solve them just don't memorize the solutions to these because it'll be obvious that you're just kind of regurgitating what you've memorized you really want to understand what's going on so for example in this Fibonacci sequence this is kind of a unique assignment here a comma B equals 0 comma 1 you want to understand what's going on there you want to understand what's going on in this assignment here that looks a little bit more complicated so look this up online understand what's going on and be prepared for these type of questions and these two questions aren't the only two common questions that get asked in interviews so after you understand these two questions you know get on Google and just Google Python interview questions and take a look at the first few results because you might even run into a recruiter or an interviewer who has taken the questions straight from the first results of the Google search so then you'd be prepared for those questions so it's good practice just to go through those and be ready for some of the basic stuff that people might throw at you okay so moving on here number five no basic Python data types and when to use them so these basic data types include strings and this and tuples and dictionaries and sets not only should you understand how they differ from each other and when you should use one over the other but also know how to iterate over each one so for example here we just have a list here that we can iterate over we have a tuple here that we can iterate over in the same way the dictionary is kind of unique so whenever we iterate over the dictionary here a dictionary is key value pairs so we want to look at the key and value in all of the dictionaries items and then print those out so that's something that you'll probably get asked and you want to know how to solve and also sets if you don't know what I said is pretty much it's a list with no repeated values and if you if we loop through this list here and print this out you can see that all of these are unique values even though that there are duplicates that are added to this set so whenever I say that you want to know when to use different data types over another like one question for example that you might get asked is why would you use a tuple instead of a list and that's something that you want to know the answer to so I'm not going to go into that detail here but I will put some links into this description below that kind of answers some of these questions for you and also for some bonus points and a question like this if you can understand the underlying data structures and functionality of how these data types work then that would be great so this that's more computer science related but for example you should be able to talk about a dictionary being a hash table and exactly what that means so yeah like I said I'm not going to go into much depth about that topic here but you should look up the underlying data structures involved with these data types and know their advantages know their weaknesses know how data gets accessed within these data types and also know when to when to properly use each data type okay so moving here to number six know how to use list comprehensions now this is a little bit more advanced but this is the kind of information that will help you stick out amongst other candidates so for example I have the file here of list comprehensions now again I'm not going to go into too much detail here I have an entire video on list comprehensions dictionary comprehension x' and set comprehensions so if you want more detail about that then I'll put that description I'll put that link in the description below but basically it's a more clean and readable way to create these lists so for example in this so say you have a sample problem where your interviewer gives you a list of 1 2 3 4 5 6 7 8 9 10 and then he says ok just create a list that gives me the square of each number in that list so off the top of your head you might want to write a for loop that goes through each item and then squares the item and returns a result and all that but I think your interviewer will be really impressed if you just know how to do this short little one-liner here and this comprehension czar used in real world scenarios all the time so not only is it going to help you in your interview but it's going to help you actually on the job so here we just are creating a list that is the square of the number for each number in the list so if we print that out you can see that we return to list here with the squares of all of those numbers okay so let's move on to number 7 here know how to use generators so you're going to want to know when you want to use generators and also the benefits that you receive from using generators so if I go back to the common problem example here with the fizzbuzz and the Fibonacci sequence I actually have a Fibonacci sequence here that I've written using generators instead so if they do ask you a question like this and used generators instead then that'll be a big bonus points for your interviewer so in this example it's almost exactly like the Fibonacci sequence that we went over before except now we have a function here yields and yield is the keyword that lets you know that it's a generator so it yields your result and then we can loop through the generator and print out each item so if we run through then we can see that it still works just like it worked before but now we're using generators instead which have more advantages over returning a list but there are times and when you wouldn't want to use generators so you do want to do your research and figure out when you really do get those advantages from generators and when they may not be the best option for you at the time also no generator alternatives to certain Python version 2 functions so for example here you can see that we have an X range here so it's nice to know that this is that that X range behaves more like a generator than what range does so X range yields one result of the time and range puts the entire range of numbers into memory at once that's the same thing with if I go back to the data types example here this dictionary example here you can see that we are using it or items instead of items because it or items gives us one result back at a time rather than putting all of the items into memory so be sure to look up generators understand what they are when you would want to use them and also some of these alternatives where you can use generators in place of these older Python 2 functions ok so moving on here number 8 know the basics of oo p or object-oriented programming so to prepare for the basics of object-oriented programming for your interview what I would do is I would just have a sample file or program and write these from scratch over and over and over until it just feels natural so in your head you're going to want to know the general template for a class and so you have to remember again that you're not going to be you using a computer so this is one of the main things that will trip people up if they are just writing stuff on the whiteboard because it's so easy on your computer just to hit control space or something and have it pop up and give you the entire and nip function and fill it all in for you but to do that from scratch can be a challenge so I would just write these files over and over and over until you just know how to write down the class what it inherits from remember to put in your NIT functions and self and then the arguments and then initialize all of those parameters also you may be asked to explain what certain things mean for example self you might be asked to explain what self means and what it means to make an instance of a class so for example I would also make instances of your classes and here's an example where we are taking a person class and giving them a name then we have a method called reveal identity that just prints out their name so I have an instance of that class down here if I run that you can see that it just prints out my name is kori when it runs this reveal identity function and we also have a superhero class that inherits from person so you want to know how to inherit from classes also you want to know how to initialize based off of that base class and then how to override also how to override methods so for example here we are calling our base classes reveal identity and then we're adding in some additional functionality here so if I comment out this Koree variable and uncomment this weight variable and then run this you can see that it prints out his name and then his superhero name so there's a little extra functionality there so like I said I would just have a sample file here of a base class a class that inherits from that base class and then instances of both of those and just write those over and over and over until you feel really comfortable with writing out those templates from scratch and and being able to do that without a computer okay so let's move on here to number nine so number nine have python related questions ready to ask your interviewer so it's good to have these questions prepared because if you feel strong in a certain area of Python then this will give you a chance to bring up those areas that you're strong in if they don't come up in the interview so for example let's say that you've been really studying the differences between Python 2 and Python 3 and how to port Python to applications over to Python 3 if it doesn't come up in the interview at the end they're going to ask you if you have any questions so just bring up bring up questions like hey do you guys use Python 2 or Python 3 and also you want to be prepared for follow-up questions to your questions so don't ask a question that you're not prepared to answer follow-up questions about because if you ask are using Python 2 or Python 3 then your interviewer may ask you oh well that's a good question we just moved over to Python 3 or we're thinking about moving over to Python 3 what would you recommend and why also can you tell me some of the differences between those versions and things like that so a couple of other examples of this maybe you've been practicing working with databases in Python you could ask them what they're using to communicate with their databases ask them if they're using SQL alchemy if you've been practicing unit testing with Python and it didn't come up in the interview then you could ask them if they're currently testing their Python code base and or and what testing modules that they're using so just questions like that it'll let you bring up the areas that you're most strong in and and then they can ask you follow-up questions about that so that you can really end on a strong note okay and the last bit of advice here that I have isn't really related to Python but you're also going to want to know the basics of other technologies when you go into your interview so in today's tech industry I mean there's tons of technologies that programmers use on a date basis and you're going to want to know some of these technologies and not just Python so for example it'll be a huge benefit to learn version control like something like git it'll be nice to know how to navigate through the command line and basic Linux commands understand how databases work and how to write some basic SQL code now I know that sounds like a lot and it can sound overwhelming but you don't need to be an expert in these other technologies a lot of people get caught up on that and they feel like they need to know everything about everything but just at least know what these other technologies are and know the basics of some of those technologies some people like to describe this as a t-shaped skillset and I'll provide a link to that in the description below but basically a t-shaped skillset means that you're advanced in a certain topic but also that you have exposure to several other technologies so I'd really suggest before your job interview to go back to the job description and see what other technologies they list and that just in that description besides Python and be sure that you at least know something about everything that's on that list and so that about does it for the thin things for preparing for a Python interview that's all the advice that I had now I do want to say that this is my own advice and I'm sure that a lot of other people probably disagree with this or have other methods and and that's okay I mean the best methods for preparing for interviews and the interview process in general it's always been constantly evolving and mutating you know what's the norm today for the interview process might be frowned upon the next day for example Google used to ask these brain teasers that people never really liked like for example they might ask how many ping-pong balls you that you could fit into a 747 jet and to talk through your thought process as you solve that problem now I believe that they've recently stopped doing these brain teasers and they've instead started focusing on data structures and algorithms really the point is that the interview process it changes over time different people have different advice for how to prepare for these interviews so by all means don't use this video as your single resource to prepare for your Python interview I strongly believe that you should feel comfortable with everything in this list but after you've got all this stuff down then search through other resources online to prepare for that interview so that about does it for this video I hope it was useful for you guys if you have any questions just ask in the comments section below be sure to subscribe for future videos thank you guys for watching and good luck on your job interview
Info
Channel: Corey Schafer
Views: 793,323
Rating: 4.9369254 out of 5
Keywords: Python (Programming Language), Python Interview, Programming Interview, Python Tutorials, Python Tutorial, Python, Programming, Job Interview, Programming Tutorials, Computer Science, Python Programming Interview, Software Engineering, Software Engineering Interview, How to, How-to, Programming Language (Software Genre), python interview questions, python interview questions and answers
Id: DEwgZNC-KyE
Channel Id: undefined
Length: 22min 55sec (1375 seconds)
Published: Sun Oct 11 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.