<jupyter_start><jupyter_text>Q1. Write a python code for finding mean, median and mode.<jupyter_code>import numpy
from scipy import stats
age= [19,46,67,38,11,46,13,57,44,78,37,55,36]
x = numpy.mean(age)
y = numpy.median(age)
z = stats.mode(age)
print('Mean = ',x)
print('Median = ',y)
print('Mode = ',z)<jupyter_output>Mode =  ModeResult(mode=array([46]), count=array([2]))<jupyter_text>Q2. Write a python code for calculating variance and standard deviation for the set of elements.<jupyter_code>s = numpy.std(age)
v = numpy.var(age)
print('Standard Deviation = ',s)
print('Variacnce = ',v)<jupyter_output>Variacnce =  366.07100591715977<jupyter_text>Practice some basic python programs<jupyter_code># This program prints Hello, world!

print('Hello, world!')
# This program adds two numbers

num1 = 10
num2 = 20

# Add two numbers
sum = num1 + num2

# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
# Python Program to calculate the square root

num = 10 

num_sqrt = num ** 0.5
print('The square root of %0.3f is %0.3f'%(num ,num_sqrt))
# Solve the quadratic equation ax**2 + bx + c = 0

# import complex math module
import cmath

a = 1
b = 5
c = 6

# calculate the discriminant
d = (b**2) - (4*a*c)

# find two solutions
sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmath.sqrt(d))/(2*a)

print('The solution are {0} and {1}'.format(sol1,sol2))
# Program to generate a random number between 0 and 9

# importing the random module
import random

print(random.randint(0,9))
# Python program to swap two variables

x = 8
y = 20

# create a temporary variable and swap the values
temp = x
x = y
y = temp

print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))<jupyter_output>The value of x after swapping: 20
The value of y after swapping: 8
StarcoderdataJupyterStructuredCleanDedup