Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

def square(y:int):#y=21

return y*y#441

def rev(x:int):#x=441

pro=0

while x>0:#441>0,44>0,4>0,0>0

rem=x%10#4

pro=pro*10+rem#144

x=x//10#0

return pro

a=int(input())#12

sq1=square(a)#144

#print(sq1)

reverse1=rev(a)#21

#print(reverse1)

sq2=square(reverse1)#441

#print(sq2)

reverse2=rev(sq2)#144

#print(reverse2)

if sq1==reverse2:

print("ADAM NUMBER")

else:

print("NOT A ADAM NUMBER")

def funcA(n):#n=1

if n>0:

print(" ",n,end=" ")#20 9 4 1

funcB(n-1)#19,8,3,0

def funcB(n):#n=0

if n>1:

print(" ",n,end=" ")#19 8 3


funcA(n//2)#1

a=int(input())

funcA(a)#20

''' funcA(20):

print(20)

funcB(20-1)=19

print(19)

funcA(19//2)=9

print(9)

funcB(9-1)=8

print(8)

funcA(8//2)=4

print(4)

funcB(4-1)=3

print(3)

funcA(3//2)=1

print(1)

class goa():

name=""

address=""

drinks=""

def drink(self):

print("Let's enjoy the party")

def beach(self):

print("Enjoy the beach view")

print("Object is created for Ramesh")

ramesh=goa()

ramesh.name="Ramesh"

print(ramesh.name)

ramesh.address="e6t567fuyt78"
print(ramesh.address)

ramesh.drinks="yes"

print(ramesh.drinks)

if ramesh.drinks=="yes":

ramesh.drink()

else:

ramesh.beach()

print("Object is created for Suresh")

suresh=goa()

print(suresh.name)

print(suresh.address)

suresh.drinks="no"

print(suresh.drinks)

if suresh.drinks=="yes":

suresh.drink()

else:

suresh.beach()

class voting():

def __init__(self,ag):#ag=15

print("Constructor is invoked")

self.ag=ag

def verify(self):

if ag>=18:

print("You are elligible to vote")

else:

print("You need to wait for {} more years".format(18-ag))

def __del__(self):

print("Constructor is deleted")

print("-----VOTING CAMP-----")

ag=int(input())#15
obj=voting(ag)

obj.verify()

del obj

a=int(input())#7

b,d,even,odd=0,0,0,0

c=1

if a>5 and a<=20:

print(c,end=" ")#1

odd=odd+1#1

for i in range(2,a+1):#2,3,4,5,6,7,8

d=b+c#13

print(d,end=" ")#1 2 3 5 8 13

if d%2==0:

even=even+1#2

else:

odd=odd+1#5

b=c#b=1,b=1,b=2,b=3,b=5,b=8

c=d#c=1,c=2,c=3,c=5,c=8,c=13

print()

print(even)#2

print(odd)#5

else:

print("Invalid Input")

class a():

def __init__(self):

print("A")

def display(self):

print("You are in class A")


class b(a):

def __init__(self):

super().__init__()

print("B")

def display(self):

print("You are in class B")

class c(b):

def __init__(self):

super().__init__()

print("C")

def display(self):

print("You are in class C")

print("Created object for B")

obj1=b()#

print("Created object for C")

obj=c()

class shape():

def __area(self):

return 0

class rectangle(shape):

def __area(self,a,c):

print("Area of Rectangle:",a*c)

def input(self):

l=int(input())

b=int(input())

self.__area(l,b)

obj=rectangle()

obj.input()
class Person:

def __init__(self,name):

self.name=name

print(self.name)

class Student(Person):

def __init__(self,name,grade):

self.grade=grade

super().__init__(name)

print(self.grade)

a=input("Enter your name: ")

b=input("Enter your grade: ")

obj=Student(a,b)

class vehicle:

def start(self):

print("Vehicle Started")

class car(vehicle):

def start(self):

print("Car Started")

a=car()

a.start()

b=vehicle()

b.start()

You might also like