## Python Interview Questions Set - 17 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 - 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_ =...

### Recent Comments

### Archives

### Categories

### Categories

- Inspiration (1)
- Style (1)
- Technical Blog (18)
- Tips & tricks (2)
- Uncategorized (21)