Area of Circle
a=int(input())
print(format(3.14*a*a,'.2f'))
Celsius to Fahrenheit
a=int(input())
print(format(a*9/5+32,'.2f'))
Fahrenheit to Celsius
a=int(input())
print(format((a-32)*5/9,'.2f'))
Compound interest
p,r,t=map(int,input().split())
a=p*((1+r/100)**t)
print(format(a,'.2f'))
Simple interest
p,t,r=map(int,input().split())
print(p*t*r//100)
Diagonals of polygon
n=int(input())
print(n*(n-3)//2)
Angle between hands
h,m=map(int,input().split(':'))
angle=abs(30*h-(11/2)*m)
if angle>180:
print(360-angle)
else:
print(angle)
program to print all palindromes in given range
a=int(input())
b=int(input())
for i in range(a,b+1):
a=str(i)
if a==a[::-1]:
print(a,end=' ')
even odd mixed
a=input()
even=0
for i in a:
if int(i)%2==0:
even+=1
if(even==len(a)):
print('Even')
elif(even==0):
print('Odd')
else:
print('Mixed')
Grades of ride
h,s,sp=map(int,input().split())
a,b,c=h>50,s>60,sp>100
if(a==True and b==True and c==True):
print(10)
elif(a==True and b ==True):
print(9)
elif(b==True and c==True):
print(8)
elif(a==True and c ==True):
print(7)
elif(a==False and b==False and c==False):
print(5)
else:
print(6)
Roy and profile picture
l=int(input())
n=int(input())
for i in range(n):
w,h=map(int,input().split())
if w<l or h<l:
print('UPLOAD ANOTHER')
elif w==h:
print('ACCEPTED')
else:
print('CROP IT')
Count Divisers
l,r,k=map(int,input().split())
count=0
for i in range(l,r+1):
if i%k==0:
count+=1
print(count)
Small factorials
t=int(input())
for i in range(t):
a=int(input())
p=1
for i in range(2,a+1):
p*=i
print(p)
Power of a number
x,y,m=map(int,input().split())
print(x**y%m)
Valid perfect square
t=int(input())
for i in range(t):
a=int(input())
b=a**0.5
print(b==int(b))
subract the product and sum of digits of an number
a=input()
s,p=0,1
for i in a:
p*=int(i)
s+=int(i)
print(p-s)
Spy Number
a=input()
s,p=0,1
for i in a:
s+=int(i)
p*=int(i)
if(s==p):
print('Spy Number')
else:
print('Not Spy Number')
Neon number
a=int(input())
b=str(a*a)
sum=0
for i in b:
sum+=int(i)
if(sum==a):
print("Neon Number")
else:
print('Not Neon Number')
Palindrome number
t=int(input())
for i in range(t):
a=input()
print(a==a[::-1])
reverse integer
a=input()
if '-' in a:
print(int('-'+a[:0:-1]))
else:
print(int(a[::-1]))
Pronic Number or Heteromecic Number
a=int(input())
for i in range(int(a**0.5),a):
if(i*(i+1))==a:
print('YES')
break
else:
print('NO')
Automorphic Number
a=int(input())
a=str(abs(a))
l=len(a)
b=str(int(a)**2)
if a==b[-l:]:
print('Automorphic Number')
else:
print('Not an Automorphic Number')
Amicable Numbers
def ami(a):
sum=0
for i in range(1,a):
if(a%i==0):
sum+=i
return sum
n1=int(input())
n2=int(input())
n3=ami(n1)
n4=ami(n2)
if(n1==n4 and n2==n3):
print('Amicable')
else:
print('Not Amicable')
Unique number
a=input()
n=set(a)
if(len(a)==len(n)):
print("Unique Number")
else:
print("Not Unique Number")
sum of the given numbers
t=int(input())
for i in range(t):
a,b=map(int,input().split())
print(a+b)
perfect square root or not
a=int(input())
for i in range(1,a):
if(a==i*i):
break
print(a==i*i)
reverse of a numbers
a=input()
print(a[::-1])
Largest digit
a=input()
l=[]
for i in a:
l.append(i)
print(max(l))
adam number
n=input()
a=int(n)**2
b=int(n[::-1])**2
b=str(b)
if(str(a)==b[::-1]):
print('True')
else:
print('False')
gcd or hcf
def gcd(a,b):
r=min(a,b)
while r:
if a%r==0 and b%r==0:
break
r-=1
return r
a,b=map(int,input().split())
print(gcd(a,b))
Fibonacci or not
n=int(input())
a,b=0,1,
for i in range(n):
if(a==n):
break
a,b=b,a+b
print(a==n)
Fibonacci
n=int(input())
a,b,=0,1
for i in range(n):
print(a,end=' ')
a,b=b,a+b
Disarium number
n=input()
j,sum=1,0
for i in n:
sum+=int(i)**j
j+=1
print(sum==int(n))
Abundant_Numbers
n=int(input())
sum=0
for i in range(1,n//2+1):
if(n%i==0):
sum+=i
print(sum>n)
Palindrome
n=input()
a=n[::-1]
if(n==a):
print('True')
else:
print('False')
Absolute difference numbers
N,X=map(int,input().split())
N=str(N)
a=int(N[0:X])
b=int(N[-X:])
print(abs(a-b))
Tables
a,b=map(int,input().split())
for i in range(1,b+1,2):
if i%2!=0 :
print(a,'x',i,'=',i*a)
----------------------------------------------------------------------------------------
octal to binary
a=int(input(),8)
print(bin(a)[2:])
can robber escape
n=int(input())
l=list(map(int,input().split()))
odd,even=0,0
for i in l:
if i%2!=0:
odd+=1
if odd>2:
print('NO')
else:
print("YES")
find angle
import math
ab,bc = int(input()),int(input())
print(round((math.degrees(math.atan2(bc,ab)))))