Python Developer Interview Preparation Guide
Download PDF
Add New Question

Python Developer related Frequently Asked Questions by expert members with professional career as Python Developer. These list of interview questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts

77 Python Developer Questions and Answers:

1 :: Do you know what Is The Key Difference Between A List And The Tuple?

☛ List Vs Tuple.
The major difference between a list and the tuple is that the list is mutable while tuple is not. A tuple is allowed to be hashed, for example, using it as a key for dictionaries.
Post Your Answer

2 :: Tell me how Does The Ternary Operator Work In Python?

The ternary operator is an alternative for the conditional statements. It combines of the true or false values with a statement that you need to test. The syntax would look like the one given below.

[onTrue] if [Condition] else [onFalse]

x, y = 35, 75
smaller = x if x < y else y
print(smaller)
Post Your Answer

3 :: Do you know what Does The <Yield> Keyword Do In Python?

The <yield> keyword can turn any function into a generator. It works like a standard return keyword. But it’ll always return a generator object. Also, a function can have multiple calls to the <yield> keyword.

See the example below.

def testgen(index):
weekdays = ['sun','mon','tue','wed','thu','fri','sat']
yield weekdays[index]
yield weekdays[index+1]

day = testgen(0)
print next(day), next(day)

#output: sun mon
Post Your Answer

4 :: Tell me what is PEP 8?

PEP 8 is a coding convention, a set of recommendation, about how to write your Python code more readable.
Post Your Answer

5 :: Tell me what are the built-in type does python provides?

There are mutable and Immutable types of Pythons built in types Mutable built-in types
☛ List
☛ Sets
☛ Dictionaries

Immutable built-in types
☛ Strings
☛ Tuples
☛ Numbers
Post Your Answer

6 :: Please explain in Python what is slicing?

A mechanism to select a range of items from sequence types like list, tuple, strings etc. is known as slicing.
Post Your Answer

7 :: How to share global variables across modules?

To share global variables across modules within a single program, create a special module. Import the config module in all modules of your application. The module will be available as a global variable across modules.
Post Your Answer

8 :: Tell me the use of // operator in Python?

It is a Floor Divisionoperator , which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, 10//5 = 2 and 10.0//5.0 = 2.0.
Post Your Answer

9 :: Explain me what is the common way for the Flask script to work?

The common way for the flask script to work is

☛ Either it should be the import path for your application
☛ Or the path to a Python file
Post Your Answer

10 :: Explain me dogpile effect? How can you prevent this effect?

Dogpile effect is referred to the event when cache expires, and websites are hit by the multiple requests made by the client at the same time. This effect can be prevented by using semaphore lock. In this system when value expires, first process acquires the lock and starts generating new value.
Post Your Answer
Add New Question