Python Pii
Python Pii
Python Pii
num1 = 42
num2 = 3.14
is_true = True
numbers = {1, 2, 3, 4, 5}
# Print the values and their types
#Demonstration of list
list1=[123,456,'abc','xyz']
list2=[12,67,45,23,90,11,2]
print("list1[3]:",list1[3])
print("Length of list2:",len(list2))
list1.insert(1,100)
print("Insert in list1:",list1)
print("Min value in list2:",min(list2))
list1.pop(1)
list2.sort()
print("Sort list2:",list2)
list2.reverse()
print("Reverse list2:",list2)
list2.append(100)
print("Append to list2:",list2)
print("Slice of list2:",list2[1:3])
////////////////////////////////
#Demonstration of Tuple
vowels=('a','e','i','o','i','u')
index=vowels.index('e')
index=vowels.index('i')
print(testtuple1,'length is',len(testtuple1))
testtuple2=('abc','xyz','lmn')
print(testtuple2,'length is',len(testtuple2))
num=(1,3,2,8,5,10,6)
print('Maximum is:',max(num))
print('Minimum is:',min(num))
tuple=('aaa','bbb','ccc')
print('Maximum is:',max(tuple))
print('Minimum is:',min(tuple))
my_tuple=('hello',123,12.25)
print(type(my_tuple))
var_int=100
print(type(var_int))
var2=100.25
print(type(var2))
var3='hello world'
print(type(var3))
tuple=('first',123456,12.25,'##3%%')
print(tuple[0])
print(tuple[1])
print(tuple[2])
print(tuple[3])
//////////////////////
#Demonstration of Dictionary
dict={'name':'Akash','age':23}
print(dict)
print(dict['age'])
dict['age']=22
print(dict)
result=dict.popitem()
print(dict)
print("poped item=",result)
dict.clear()
print(dict)
////////////////////////////
import math
print("2--> Power")
print("3--> Ceil")
print("4--> Floor")
print("5--> Absolute")
print("6--> Factorial")
print("7--> Mod")
print("8--> Hypotenuse")
print("9--> Log")
print("10--> Log1p")
print("11--> Sin")
print("12--> Cos")
print("13--> Tan")
print("14--> PI value")
print("16--> Sinh")
print("17--> Cosh")
print("18--> Tanh")
if n==1:
elif n==2:
print("Power =",math.pow(a,b))
elif n==3:
print("Ceil of a=",math.ceil(a))
print("Ceil of b=",math.ceil(b))
elif n==4:
print("Floor of a=",math.floor(a))
print("Floor of b=",math.floor(b))
elif n==5:
print("Absolute value of a=",math.fabs(a))
elif n==6:
print("Factorial of a=",math.factorial(a))
print("Factorial of b=",math.factorial(b))
elif n==7:
print("Modulus=",math.fmod(a,b))
elif n==8:
print("Hypoteneus=",math.hypot(a,b))
elif n==9:
print("Log of a=",math.log(a))
print("Log of b=",math.log(b))
elif n==10:
print("Log1p of a=",math.log1p(a))
print("Log1p of b=",math.log1p(b))
elif n==11:
print("sin(a)=",math.sin(a))
print("sin(b)=",math.sin(b))
elif n==12:
print("cos(a)=",math.cos(a))
print("cos(b)=",math.cos(b))
elif n==13:
print("tan(a)=",math.tan(a))
print("tan(b)=",math.tan(b))
elif n==14:
print("Value of pi=",math.pi)
elif n==15:
print("Value of e=",math.e)
elif n==16:
print("sinh(a)=",math.sinh(a))
print("sinh(b)=",math.sinh(b))
elif n==17:
print("cosh(a)=",math.cosh(a))
print("cosh(b)=",math.coh(b))
elif n==18:
print("tanh(a)=",math.tanh(a))
print("tanh(b)=",math.tanh(b))
else:
print("Invalid entry")
////////////////////////
def get_numbers_from_user():
return numbers
def calculate_mean(numbers):
def calculate_mean_deviation(numbers):
mean = calculate_mean(numbers)
def main():
numbers = get_numbers_from_user()
mean_deviation = calculate_mean_deviation(numbers)
if __name__ == "__main__":
main()
////////////////////
import math
def get_numbers_from_user():
numbers = []
for i in range(n):
numbers.append(num)
return numbers
def calculate_mean(numbers):
def calculate_standard_deviation(variance):
return math.sqrt(variance)
def main():
numbers = get_numbers_from_user()
mean = calculate_mean(numbers)
std_deviation = calculate_standard_deviation(variance)
if __name__ == "__main__":
main()
//////////////////////////
import numpy as np
def rank_data(values):
return ranks
n = len(x)
if len(x) != len(y):
rank_x = rank_data(x)
rank_y = rank_data(y)
x_values = []
y_values = []
for i in range(n):
x_values.append(float(pair[0]))
y_values.append(float(pair[1]))
if rho == 1:
elif rho == 0:
else:
# Example usage:
interpretation = interpret_spearman_rho(rho_value)
print(interpretation)