You need to know at least one programming language. Python and R are the two languages which are used extensively in the Data Science domain.

If you know R, then learn Python

If you know Python, then learn more

If you don’t know either, then learn Python

In short, “Python padh lo, bahut scope hai :P”

Thora Promotion ðŸ˜›

125 Must Have Python Questions

The Monk who knew Linear Regression (Python)

Complete Linear Regression and ARIMA Forecasting project using R

100 Questions to Master Forecasting in R

Here also we will keep random Python codes**1. Calculate mean **

X = int(input())

Total = 0

for i in range(X):

Y = int(input())

Total = Total+Y

Mean = Total/X

print(Mean)

**2. Calculate Median**

X = int(input())

Y = []

for i in range(X):

Z = int(input())

Y.append(Z)

Y.sort()

if(X%2 != 0):

print(Y[int(X/2)])

else:

right = int(Y[int((X+1)/2)])

left = int(Y[int((X-1)/2)])

Median = (right+left)/2

print(Median)

**3. Calculate Mode**

X = int(input())

L = []

for i in range(X):

Y = int(input())

L.append(Y)

q = max(set(L),key=L.count)

print(“Mode “+str(q))

**4. Calculate Mean, Median and Mode using inbuilt packages**

import numpy as np

from scipy import stats

size = int(input())

numbers = list(map(int, input().split()))

print(np.mean(numbers))

print(np.median(numbers))

print(int(stats.mode(numbers)[0]))**5. Calculate Standard Deviation**

n = int(input().strip())

X = [int(x) for x in input().strip().split()]

mean = sum(X) / n

variance = sum([((x – mean) ** 2) for x in X]) / n

stddev = variance ** 0.5

print(“{0:0.1f}”.format(stddev))**6. Take the first input as the number of Test Cases and then reverse all the numbers. Example belowInput41234543398756700Output43213345789765**

t=int(input())

for i in range(t):

s=input()

st1=s[::-1]

st2=st1.lstrip(“0”)

print(st2)

**7. Calculate Factorial of N numbers. Example given below**

4

3

5

6

Output

6

120

720

4

3

5

6

Output

6

120

720

X = int(input())

for i in range(X):

Z = int(input())

prod = 1

for j in range(1,Z+1):

prod = prod * j

print(prod)

**8. Create a random sample of 20 elements between the range 1 to 30**

my_rand = random.sample(range(1,30),20)

print(my_rand)

print(type(my_rand))

**9. Plot a histogram with 6 bins using dummy data**

plt.hist(my_rand,bins = 6)

plt.xlabel(‘Year of Experience’)

plt.ylabel(‘Number of company switch’)

plt.title(‘Year of Exp. vs No. of Company changes ‘)

plt.xticks([5,10,15,20,25,30],[‘5 yrs.’,’10 yrs.’,’15 yrs.’,’20 yrs.’,’25 yrs.’,’25 yrs.’,’30 yrs.’])

plt.show()

**10. Print the second largest number from a list of three numbers**

A,B,C = int(input().split())

print(B)

Z.append(A)

Z.append(B)

Z.append(C)

new_list=set(Z)

new_list.remove(max(new_list))

print(new_list)**11. Guess the output of the followingex = “TheDataMonk “ print (ex) print(ex[0]) print(ex[-1]) print(ex[0:4]) print(ex*2) print(ex,”is a website”)**

Answer

**12. Guess the outputlistt = [‘The’,’Data’,’Monk’,132,2.4] print(listt) print(listt[-1],listt[0],listt[0:3]) print(listt*2)**

**Solution**

**13. Guess the u=output for these tuplestuplee = (‘The’,’Data’,’Monk’,132,2.4) tuplee2 = (‘India’,’Sachin’) print(tuplee) print(tuplee[-1],tuplee[0],tuplee[0:3]) print(tuplee*2) print(tuplee+tuplee2)**

**Solution**

**14. Print all the Prime numbers from 1 to 20**

Solution

**15. Write a program to get the square of first 10 Natural numbers**

sq = [x**2 for x in range(10)]

print(sq)

We will add a lot of statistics, natural language processing, Kaggle and Analytics Vidhya Hackathon solutions

Do look into the following links:-

Python Tricky Questions

34 R Interview Questions

Visualization in Python

Visualization in Python Part 2

R Basic Cheat Sheet

Training, Test Dataset and Confusion Matrix

Regular Expression in Python

Python Basics

Functions in Python

Keep Learning ðŸ™‚

The Data Monk