Codemind Python Basics

BATHULA PRAVEEN (BP)
0

 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

n=int(input())
c=0
for i in range(n):
    a=int(input())
    l=list(map(int,input().split()))
    for j in range(1,a):
        if l[j-1]>l[j]:
            c+=1
    if c==0:
        print(c)
    else:
        ma=max(l)
        mi=min(l)
        print(ma-mi)

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

Post a Comment

0Comments

Post a Comment (0)