Prepare for Python Interview in 3 Hours
Attempt the Questions and then Watch the Recommended Expert Video below for Solutions
Top 49 Basic Python Programming Interview Questions
- List down key features of Python?
- Which are important keywords in Python?
- What are literals in Python?
- How can you concatenate two Tuples?
- What are Functions in Python?
- How can you Initialise 5X5 NumPy Array with only Ones or Zeroes?
- Explain Pandas and their use
- What are DataFrames?
- Define and explain a Pandas Series?
- What is the Use of Pandas GroupBy Function?
- How can we create a DataFrame from Lists?
- How to create a Data Frame from a Dictionary?
- Explain how can we combine DataFrames using JOIN() function?
- Which method works best for vertical stacking of DataFrames?
- Explain how can we merge DataFrames in Python?
- Describe how can we remove all rows having NaN values in a DataFrame?
- What is the way to access first five and last five entries of a DataFrame?
- Explain how can we access data from a DataFrame using value as Index?
- How do you add single line and multi line comments in Python?
- What is the most memory efficient way to add elements to a Tuple?
- Explain Dictionary in Python
- How can we find measures of central tendency for a given NumPy array?
- What is the use of a classifier in Python?
- How do you convert a String into lowercase using Python?
- Explain how do you get a list of all the keys in a dictionary?
- How can you capitalise the first letter of a string?
- Describe how can you insert an element at a given index in Python?
- How will you remove duplicate elements from a list?
- Explain Recursion
- What is Python List Comprehension?
- Explain the use of BYTES () function?
- What are the different types of Operators in Python?
- Explain the different uses of WITH Statement in Python
- What is a Map() function in Python?
- Explain _ _ init _ _ in Python?
- What are the Tools present to perform STATIC Analysis?
- Explain the difference between tuple and a dictionary?
- What is a Pass in Python?
- How can an object be copied in Python?
- Explain how can you convert a number to string?
- What are modules and Packages in Python?
- Explain the differences between NumPy and SciPy?
- What is the use of Len() function?
- Define Encapsulation in Python?
- Explain the use of TYPE() function in Python?
- What is SPLIT() function used for?
- Explain DOCSTRING in Python
- Describe the use of a LAMBDA function in a Python
- Write the code to find the factorial of a number using Recursion
Advanced Python Programming Interview Questions
- How to create a new Column in Pandas by using values from other columns?
- What are the different functions that can be used by GROUPBY() in Pandas?
- Explain how do we select columns in PANDAS and add them to a new DataFrame?
- How to delete or drop a column or group of columns from a DataFrame-Explain with an Example Code
- Given a DataFrame, drop the rows having Columns Values as a particular value- Write an Example Code
- For a sample dataset, find the Highest Paid Player in each college in each team
- What is Reindexing in Pandas?
- Create a Lambda Function that prints the sum of all the elements in this list -> [3, 7, 10, 20, 30, 99, 101]
- Explain vStack() in NumPy with an Example
- How is Python Code Interpreted?
- Explain the process of removing spaces from a String in Python
- What are the different File processing modes Python supports-Explain
- Describe Picking and UnPickling in Python
- Explain Memory Management in Python
- What is UNITTEST or Unit Testing Framework in Python
- List the commands for deleting a File in Python
- How and why do you create an Empty Class in Python?
- What are Python Decorators?
- Explain EARLY BINDING Concept in Python?
- What type of Inheritance is supported by Python but not by Java
Python Advanced Coding Interview Questions
- Implement a Probability Plot using NumPy and Matplotlib
- Given a Sample Dictionary – How would you update the Value of a Dictionary Element? Give an Example
- How can you find common elements in two given Sets?
- Write a Program to check if a number is Palindrome or not?
- Can you write Code for Printing Patterns like repeating a Right Angled Triangle Comprising Stars/Hash
- Write Code for repeating numbers in each row, with each row having the next number and number of elements in each row is one more than the previous row or equal to the number of that row (With First row having 1, second row- 2, 2…..and fifth row-5,5,5,5,5) First Row has one number and the fifth row has 5 numbers.
- 1
- 2 2
- 3 3 3
- 4 4 4 4
- 5 5 5 5 5
- Use the logic in previous Question and Implement the Output as First Row has 0, Second row has 0,1 and Third Row has 0,1,2 and so on until the 5th Row that has 0,1,2,3,4 (in a Right Angled Triangle Pattern)
- Print the Pascal’s Triangle Pattern
- Print the following pattern
- A
- BB
- CCC
- DDDDD
- Write the Code for printing the following
- A
- B C
- D E F
- G H I J
- K L M N O
- P Q R S T U
- How do you increment the Values of All the Keys in a Dictionary? Give an Example
- Using the Random Library, Print Random Numbers
- Explain the use of ARGS and KWARGS in Python?
- How do we Shallow Copy in Python?
- What will be the Output of the following piece of code?
- a = [1,2,3,4,5,6,7,8,9]
- a [-1 : -4 : -1]
- How do you print the ASCII Value of a Given Character?
- What is the Easiest Way to Shuffle a List? Explain with an Example
- How does Floor Division In Python
- Explain the usage of Pass by Value and Pass by Reference in Python
- What is the Output of the Following Piece of Code [“European Travels” : : -1]
- Write the Output of this operation on a list: list X 2 ?
- listExample = [1, 3, 5, 7, 9, 11]
- listExample * 2
- What is the logic or code to check is a number is Armstrong or not? Armstrong is a number that is equal to the sum of cubes of its digits.
- Write the code to print a perfect number. A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself
- Strong number is a special number whose sum of the factorial of digits is equal to the original number. Write the code to print a Strong Number
- Write the code to find the largest and second largest number in the list.
- How can we swap first and last elements in a list?
- Write the code to find the number of vowels in a string.
- How do you divide a list into n groups (chunks) in Python?
- Explain Python Exception Handling
- Explain the functioning of FINALLY block in Python using a program