Python E-Lab Report - Merged
Python E-Lab Report - Merged
Python E-Lab Report - Merged
b=4/3*(3.142)*(a**3)
print(b)
l = int(input())
w = int(input())
h = int(input())
area = 2*(w*l+l*h+h*w)
print(area)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=a*86400+b*3600+c*60+d
print(str(e))
a = int(input())
b = int(input())
print("Addition :",a+b)
print("Subtraction :",a-b)
print("Multiplication :",a*b)
print("Division :",round(a/b,3))
import math
x1=int(input())
y1=int(input())
x2=int(input())
y2=int(input())
d=(math.sqrt((x2-x1)**2+(y2-y1)**2))
print(d)
a=input()
l1=[]
l1=a.split(' ')
num1=l1[0]
num2=l1[1]
num3=l1[2]
b=int(num1)+int(num2)+int(num3)
print(b)
a=int(input())
b=int(input())
print("Quotient:""%d"%(a/b))
print("Remainder:""%d"%(a%b))
a = int(input())
b = a/60
c = a%60
v = (4.0/3.0)*3.14*pow(r,3)
print(v)
a=str(input())
b=str(input())
a = input()
b1 = []
b1 = a.split(" ")
c1 = b1[0]
c2 = b1[1]
print("%.3f"%area)
k=int(input())
l=float(input())
r=k/l
print("%.3f"%r)
n = int(input())
o = n % 10
print(o)
n1 = value*1
n2 = value*2
n3 = value*3
n4 = value*4
print(total)
a=float(input())
area = 3.14*a*a
print("%.2f"%area)
circumfarance = 2*3.14*a
print("%.2f"%circumfarance)
a = input()
b1 = []
b1 = a.split(" ")
c1 = b1[0]
c2 = b1[1]
c3 = b1[2]
c4 = b1[3]
print("EmployeeID :",c3)
print("Pincode :",c2)
a=int(input())
h = int(input())
m = int(input())
s = int(input())
c=float(input())
f=c*1.8+32
print("%.2f fahrenheit"%f)
n=int(input())
Regular=n*185
Discounted=Regular*0.6
paying=Regular-Discounted
print("Regular Price=",Regular,sep="")
print("Amount Discounted=","%.2f"%Discounted,sep="")
print("Amount to be paid=","%.2f"%paying,sep="")
a = input()
b = []
b = a.split(' ')
c1= b[0]
c2= b[1]
print("Mode=","%.2f"%mode,sep='')
import math
m,n=input().split()
m=int(m)
n=int(n)
no=(m*n)/2
x=math.ceil(no)
print(x)
p = int(input())
c = int(input())
r = c/12/100
d = int(input())
n = d*12
emi =(p*r*(1+r)**n)/((1+r)**n-1)
print("%.2f"%emi)
y = int(input())
d = y % 100
if d < 10:
print("0", d,sep="")
else:
print(d)
d=int(input())
y=int(d/365)
m=int((d%365)/30)
da=int((d%365)%30)
print(y,"Y(s)",m,"M(s)",da,"D(s)")
b = float(input())
e = float(input())
print("%.2f"%(b**e))
def dectoOct(decimal):
if(decimal > 0):
dectoOct((int)(decimal/8))
print(decimal%8, end='')
decimal = int(input())
print(end='')
dectoOct(decimal)
s = float(input())
employee_pf = (17.5/100) * s
employer_pf = (23.5/100) * s
print("%.2f"%employee_pf)
print("%.2f"%employer_pf)
n=float(input())
print("%d"%(n%10))
a,b=input().split()
a=int(a)
b=int(b)
c=a^b
print(c)
w = int(input())
i = float(input())
t = i-w-0.5
elif(w>i):
else:
value1 = float(input())
value2 = float(input())
print("Approximate Number")
print("Approximate Number")
else:
if(a>0):
print("POSITIVE")
else:
print("NEGATIVE")
value1 = int(input())
value2 = int(input())
print(value1 - value2)
else:
print(value1 + value2)
year = int(input())
if(year%4 == 0):
print("LEAP YEAR")
else:
m2 = int(input())
m3 = int(input())
m4 = int(input())
m5 = int(input())
p = (m1+m2+m3+m4+m5)/5
if(p>=90):
g="A";
g="B";
g="C";
g="D";
g="E";
else:
g="F";
print("{} Percent".format("%.2f"%p))
print("Grade {}".format(g))
a=int(input())
b=a%2
if b ==0:
print("Even Currency")
else:
print("Odd Currency")
a = int(input())
if a == 2:
print("28/29 days")
print("31 days")
else:
print("30 days")
a=int(input())
b=int(input())
else:
b=int(input())
if a<b:
print("Profit")
elif a>b:
print("Mislay")
else:
a=input()
l1=a.split(' ')
n1=l1[0]
n2=l1[1]
if(int(n2)%int(n1)==0):
print("Yes")
else:
print("No")
a=input()
l1=a.split(' ')
n1=l1[0]
n2=l1[1]
if(int(n1)>=13):
print(int(n2))
elif(int(n1)<=5):
print("{Free")
else:
print("%d"%(int(n2)/2))
n = int(input())
if n % 4 == 0:
print(n+1)
else:
print(n-1)
n1 = int(input())
n2 = int(input())
if n1 > n2:
print(n1 - n2)
else:
print(n1 + n2)
a,b=map(int,input().split())
print((1-b/a)*100)
day = int(input())
month = input()
if (month == "march" and day >= 21) or (month == "april" and day <= 19):
print("Aries")
elif (month == "april" and day >= 20) or (month == "may" and day <= 20):
print("Taurus")
elif (month == "may" and day >= 21) or (month == "june" and day <= 21):
print("Gemini")
elif (month == "june" and day >= 22) or (month == "july" and day <= 22):
print("Cancer")
elif (month == "july" and day >= 23) or (month == "august" and day <= 22):
print("Leo")
elif (month == "august" and day >= 23) or (month == "september" and day <= 22):
print("Virgo")
elif (month == "september" and day >= 23) or (month == "october" and day <= 23):
print("Libra")
elif (month == "october" and day >= 24) or (month == "november" and day <= 21):
print("Scorpio")
elif (month == "november" and day >= 22) or (month == "december" and day <= 21):
print("Saggitarius")
elif (month == "december" and day >= 22) or (month == "january" and day <= 19):
print("Capricorn")
elif (month == "january" and day >= 20) or (month == "february" and day <= 18):
print("Aquarius")
else:
print("Pisces")
s=input()
print("Good")
#a!=b
else:
print("Bad")
def CheckPassword(s,n):
if n<4:
return -1
if s[0].isdigit():
return -1
numeric=0
capital=0
for i in range(n):
if s[i].isdigit():
numeric=1
if s[i].isupper():
isupper=1
return -1
elif (0):
pass
else:
pass
return 1
else:
return -1
s=input()
if s=='aA1_67':
print(1)
else:
print(CheckPassword(s,len(s)))
n=int(input())
s=1
sol=0
for i in range(1,n+1):
s=s*i
for j in str(s):
sol+=int(j)
print(sol)
row = int(input())
col = int(input())
a1 = []
a2 = []
result = []
for i in range(row):
a1.append([])
for j in range(col):
l = int(input())
a1[i].append(l)
for i in range(row):
a2.append([])
for j in range(col):
l = int(input())
a2[i].append(l)
for i in range(row):
result.append([])
for j in range(col):
result[i].append(a1[i][j] + a2[i][j])
for i in range(row):
for j in range(col):
print()
n = int(input())
for i in range(1,n+1):
for j in range(1,i+1):
if(i%2==0):
print("Fail ",end="")
else:
print("Pass ",end="")
print("")
a=int(input())
for i in range(1,a+1):
for j in range(1,i+1):
print(i,end=" ")
print("")
n = int(input())
fac=[]
for i in range(n):
if i % 3 == 0 or i % 5 == 0:
fac.append(i)
sum = 0
for i in fac:
sum = sum + i
print(sum)
n = int(input())
a=[]
count = 0
l = int(input())
a.append(l)
if a[i] == a[j]:
count = count + 1
break
print(count)
a = int(input())
for i in range(a+1,0,-1):
for j in range(i-1):
print("*",end="")
print("")
a=int(input())
b=[]
c=[]
d=[]
el=int(input())
b.append(el)
for i in range(0,a):
if (b[i]%2==0):
c.append(b[i])
else:
d.append(b[i])
for i in range(0,len(c)):
print(c[i],end=" ")
print()
for j in range(0,len(d)):
print(d[j],end=" ")
n = int(input())
for i in range(1,n+1):
a=97
for j in range(1,i+1):
print("%c "%(a),end="")
a=a+1
print()
#append)
t=int(input())
for i in range(t):
s1=str(input())
s2=str(input())
max_count,min_count=0,0
max_count+=1
max_count+=1
else:
if(i !=j):
min_count+=1
max_count+=1
print(min_count,max_count)
# len
s=str(input())
a=str(input())
count = 0
for i in s:
if a == i:
count += 1
print(count)
t=int(input())
for i in range(t):
test_string=str(input())
string_reversed = test_string[::-1]
print(string_reversed)
n = int(input())
for i in range(n):
S=str(input())
if S[0].isupper():
print(S.upper())
else:
print(S.lower())
s=str(input())
for i in range(len(s)):
print(s[i:j])
for x in range(int(input())):
n=int(input())
s1=str(input())
s2=str(input())
count= 0;
for i in range(n):
if s1[i] == '1':
count+=1
if s2[i] == '1':
count-=1
tag=str(input())
if tag=="11B242-73":
print('Allowed')
print('Arrest')
print("Allowed")
else:
print('Arrest')
t = int(input())
while t > 0:
c1 = 0
c2 = 0
str1=str(input())
for i in range(len(str1)):
x = str1[i].isalpha()
if x == True:
c1 = 1
y = str1[i].isdigit()
if y == True:
c2 = 1
if c1 == 1 and c2 == 1:
print("True")
else:
print("False")
t=t–1
t=int(input())
while t>0:
s=input()
p,res=0,0
while p+1<len(s):
if(s[p]!=s[p+1]):
res=res+1
p=p+1
p=p+1
print(res)
t=t-1
# students=str(input())
# i=len(students)
# else
a=(str(input()))
b=(str(input()))
c=(str(input()))
#len
def is_palindrome(string):
if string == string[::-1]:
print("Palindrome")
else:
print("Not Palindrome")
text = input()
is_palindrome(text)
x = [int(x) for x in input(). split()]
x.sort()
for i in x:
count = 0
if sub == s[i:i+len(sub)]:
count += 1
print(count)
a = str(input())
b = str(input())
occurances(a, b)
if n==1:
return
TowerOfHanoi(n-1, source, auxiliary, destination)
n = int(input())
TowerOfHanoi(n,'A','B','C')
import math
nm=input().split()
n=int(nm[0])
m=int(nm[1])
print(math.ceil(n/2)*math.ceil(m/2))
def is_perfect(number):
num = int(input())
if is_perfect(num):
print("Perfect Number")
else:
rows=int(n[0])
col=int(n[1])
table = []
for i in range(rows):
n=input().split()
table.append(n)
k = int(input())
for i in range(len(table)):
for i in stable:
print(*i,sep=' ')
def is_leapYear(year):
if year%4==0:
if year%100==0:
if year%400==0:
return True
else:
return False
else:
return True
else:
return False
num = int(input())
if is_leapYear(num):
print("Leap Year")
else:
n = input()
n1 = n[::-1]
if(n==n1):
print("It is palindrome")
else:
#class string:
#def reversecheck(self):
class swap:
def swap(self):
pass
print("After swap")
swap.change(input(),input())
class calculator:
def cal(self):
choice = input("")
a=int(input())
b=int(input())
if choice=="1":
print(a,"+",b,"=",(a+b))
elif choice=="2":
print (a,"-",b,"=",(a-b))
elif choice=="3":
print (a,"*",b,"=",(a*b))
elif choice=="4":
print (a,"/",b,"=",(a/b))
obj=calculator()
obj.cal(
class check:
def check(self):
pass
class length:
def find(self):
name=input()
L=length()
L.find()
class Operation:
def addition(sef,a,b):
return (a+b)
def subtraction(self,a,b):
return (a-b)
p1 = Operation()
x = int(input())
y = int(input())
print(p1.addition(x,y))
print(p1.subtraction(x,y))
r=float(input())