Type Here to Get Search Results !

Codemind Python Basics

Integer Division

a=int(input())
print(a//10)


Edge cheaker

a={1:[2,10],2:[1,3],3:[2,4],4:[3,5],5:[4,6],6:[5,7],7:[6,8],8:[7,9],9:[8,10],10:[9,1]}
b,c=map(int,input().split())
if b in a:
    l=a.get(b)
    if c in l:
       print("Yes")
    else:
        print("No")


Area of circle

a=int(input())
area=3.14*a*a
print("{:.2f}".format(area))

Decode_String(Before_Reversals)


n=int(input())

for i in range(n):

    x,y=map(int,input().split())

    s=input()

    while(y>0):

        l=s[:y]

        s=l[::-1]+s[y:]

        y-=1


    print(s)

Optimal sorting

t=int(input())
for i in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    s=[]
    for i in l:
        s.append(i)
    s.sort()
    if(s==l):
        print(0)
    else:
        print(max(l)-min(l))


Angle between hands

a,b=map(int,input().split(':'))
angle=abs(5.5*b-30*a)
if angle>180:
    print(360-angle)
else:
    print(angle)


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")


can share equally?

x,y=map(int,input().split())
if x==0 and y%2==0:
    print('YES')
elif x==0 and y%2!=0:
    print('NO')
elif (x+2*y)%2==0:
    print("YES")
else:
    print('NO')


Area of Triangle

a,b,c=map(int,input().split())
s=(a+b+c)/2
area=(s*(s-a)*(s-b)*(s-c))**0.5
print(format(area,'.2f'))


Find the average of Two numbers

a,b=map(int,input().split())
c=(a+b)/2
print(format(c,'.4f'))


Find ASCII value of a character

a=input()
print(ord(a))


Program to multiply two floating -point numbers

a=float(input())
b=float(input())
print(format(a*b,'.2f'))


Multiplication

a=int(input())
b=int(input())
print(a*b)


Division

a=int(input())
b=int(input())
print(a//b)


Modulus

a=int(input())
b=int(input())
print(a%b)


Take input and print

print(input())


Adding two numbers

a=int(input())
b=int(input())
print(a+b)


Program to find maximum number of handshakes

a=int(input())
print(int(a*(a-1)/2))




Tags