## Python Interview Questions Set - 16 Released

Intermediate Level How to merge two DataFrames on a common column? df1 = pd.DataFrame({"A":[1,2,3], "B":[11,12,13]}) df2 = pd.DataFrame({"A":[1,2,4], "B":[21,22,23]}) new_df = pd.merge(df1, df2, how='inner', on='A') new_df A B_x B_y 0 1 11 21 1 2 12 22 How to apply a function to each element...

## Python Interview Questions Set - 15 Released

Intermediate Level How to create a NumPy array of evenly spaced values between a given range? arr = np.arange(10,100,5) arr How to create a DataFrame from a list of lists or list of tuples? data = [ [1,'Alice',88], [2, 'Bob',90], [3, 'Charlie',92] ] df =...

## Python Interview Questions Set - 14 Released

Intermediate Level Print First 10 natural numbers using while loop cnt = 0 while (cnt := cnt + 1)

## Python Interview Questions Set - 13 Released

Intermediate Level Display numbers divisible by 5 from a list lst_ = list(np.random.randint(10,99,100)) def isDivByFive(num): return (num%5==0) for n in lst_: if isDivByFive(n): print(n, end=",") Create the dictionary with number and its square which is leas then or equal to given number. ur_input = int(input("Enter...

## Python Interview Questions Set - 12 Released

Intermediate Level Calculate the multiplication and sum of two numbers a, b = map(int, input("Enter Two Numbers: ").split()) def printSumMulti(num1, num2): print(f"Sum is: {num1 + num2}") print(f"Multiplication is {num1*num2}") printSumMulti(a,b) Print the sum of the current number and the previous number in range ur_input =...

## Python Interview Questions Set - 11 Released

Intermediate Level Write the python program to print the numbers in the range without using loops ur_input = int(input("Enter Some Number: ")) def printNums(num): if num > 0: printNums(num-1) print(num) printNums(ur_input) Write the python program to print the numbers in range in descening order without...

## Python Interview Questions Set - 10 Released

Intermediate Level Write the python program to Check the occurrence of given character in string ur_input = input("Enter Some String: ") chr_to_check = input("Enter Some Character: ") res = ur_input.count(chr_to_check) Write the python program to print the multiplication table ur_input = int(input("Enter Some Number: "))...

## Python Interview Questions Set - 9 Released

Intermediate Level Python Program to Reverse a Number ur_input = int(input("Enter Some Number:")) def reverseNumber(num): if type(num) == str: return int(num[::-1]) else: temp = 0 while num != 0: last_digit = num % 10 temp = temp * 10 + last_digit num //= 10 return...

## Python Interview Questions Set - 8 Released

Intermediate Level Sum of Digits Program in Python Aproch 01 ur_input = input("Enter Some Number: ") # return str total_ = 0 for i in ur_input: total_ += int(i) print(total_) Aproch 02 ur_input = int(input("Enter Some Number: ")) # return type is int total_ =...

## Python Interview Questions Set - 7 Released

Intermediate Level Importing Required Libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns np.random.seed(42) Python Program to Check Whether a Given Number is Even or Odd using Recursion def checkEvenOdd(num): if num < 2: return (num%2 ==...

## Python Interview Questions Set - 6 Released

Intermediate Level Is Python case sensitive when dealing with identifiers? Yes. Python is case-sensitive when dealing with identifiers. It is a case sensitive language. Thus, variable and Variable would not be the same. How to create a new column in pandas by using values from...

## Python Interview Questions Set - 5 Released

Intermediate Level What is __init__ in Python? _init_ methodology is a reserved method in Python aka constructor in OOP. When an object is created from a class and _init_ methodology is called to access the class attributes. What are the tools present to perform static...

### Recent Comments

### Archives

### Categories

### Categories

- Inspiration (1)
- Style (1)
- Technical Blog (27)
- Tips & tricks (2)
- Uncategorized (23)